Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

javascript action and submit form

Javascript coding ..

Moderators: macek, egami, gesf

javascript action and submit form

Postby harivallabhshukla » Sun Jul 21, 2013 5:24 am

i have given following code in javascript .Here k and m are javascript variable
document.forms[formname].action="gotopage.php?parameter1="+k+"&parameter2="+m;
document.forms[formname].submit();

above code execute correctly when my html form has method POST.Below is my html page
<form name="formname" action=# method=POST>
<input type=text name="data1" value="one">
<input type=text name="data1" value="two">
<input type=button name="button1" value="send" onclick="javascritfunction();">
</form>

BUT when i give method GET in html form then html form data is submit i.e
gotopage.php?data1=one&data2=two is submitting not javascript action value i.e
gotopage.php?parameter1="+k+"&parameter2="+m

so how to submit form with javascript parameter when method is GET in html form
harivallabhshukla
New php-forum User
New php-forum User
 
Posts: 5
Joined: Tue Jul 16, 2013 2:54 am

Return to JavaScript

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.