[英]Post Single Form Value To Self With On Click Href
我有一个基本表格。 所有元素都是文本字段。
最后有一个常规的提交按钮,可将表单发布到另一个页面。
问题是我在表单中有一个文本字段,我希望能够在运行脚本后将其发布到表单并重新加载页面。
样例代码:
<?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" />
我想我可以使用某种JavaScript来做到这一点,这些JavaScript可以通过表单中图像的onclick
处理程序执行。 任何帮助,将不胜感激。
<a href="#" onclick="onclick="document.getElementById("form").submit(); return false;">
您是否正在寻找这样的东西?
<?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" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.