I have a basic form. All the elements are text fields.
There is a regular submit button at the end that posts the form to another page.
The problem is I have one text field within the form, that I want to be able to post to the form and reload the page after running through a script.
Sample code:
<?php
if (isset("var_needed"){
... Do all this....
}else;
?>
<form id="form" action="post_to_next_page.php" >
<input name="var1" type="text" id="var1"/>
<input name="var2" type="text" id="var2"/>
<input name="var3" type="text" id="var3"/>
<input name="var_needed" type="text" id="var_needed" />
<a href="#" onclick="...?...."><img src="../image/_apply_code_button.jpg" width="132" height="28" />
<input name="var4" type="text" id="var4"/>
<input name="var5" type="text" id="var5"/>
<input type="submit" name="submit" id="submit" value="Submit" />
I figure I can do this with some sort of JavaScript that gets executed with the onclick
handler of an image within the form. Any help would be appreciated.
<a href="#" onclick="onclick="document.getElementById("form").submit(); return false;">
Are you looking for something like this?
<?php
if (isset($_GET['somevar'])){
... Do all this....
}else;
?>
<form id="form" action="post_to_next_page.php" >
<input name="var1" type="text" id="var1"/>
<input name="var2" type="text" id="var2"/>
<input name="var3" type="text" id="var3"/>
<input name="var_needed" type="text" id="var_needed" />
<a href="?somevar=yes"><img src="../image/_apply_code_button.jpg" width="132" height="28" />
<input name="var4" type="text" id="var4"/>
<input name="var5" type="text" id="var5"/>
<input type="submit" name="submit" id="submit" value="Submit" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.