Note that there are some explanatory texts on larger screens.

plurals
  1. POSubmit form using <a> tag
    text
    copied!<p>I am trying to submit a form through onclick event on tag. I have tried triggering document.myform.submit(), this.form.submit(), parentNode.submit() etc. but none of this is working! Using a submit button, the code works fine. But I want to use tag in place of that. Need some help.</p> <pre><code> &lt;form id="myform" name="myform" method="POST" action="process_edit_questionnaire.php?project=&lt;?php echo $project_id; ?&gt;"&gt; &lt;input name="module" type="hidden" value="&lt;?php echo $module_id;?&gt;"/&gt; &lt;input name="project" type="hidden" value="&lt;?php echo $project_id;?&gt;"/&gt; &lt;input name="hidden_ques_id" type="hidden" value="&lt;?php echo $data_array_ques[$j]['ques_id'];?&gt;"/&gt; &lt;div id="question_block"&gt; &lt;div id="serial_block"&gt; &lt;p id="s_original_&lt;?php echo $j+1; ?&gt;"&gt;&lt;a href="#" onclick="showSelectBox(&lt;?php echo $j+1; ?&gt;)"&gt;Serial : &lt;?php if($data_array_ques[$j]['ques_position']==NULL){ echo $j+1; } else { echo $data_array_ques[$j]['ques_position']; } ?&gt;&lt;/a&gt;&lt;/p&gt; &lt;p id="s_select_box_&lt;?php echo $j+1; ?&gt;" style="display: none;"&gt;Serial : &lt;select name="serial"&gt; &lt;?php for($p=1;$p&lt;=count($data_array_ques);$p++){ ?&gt; &lt;option value="&lt;?php echo $p; ?&gt;" &lt;?php if($p==$data_array_ques[$j]['ques_position']){ echo "selected=\"selected\"";} ?&gt; &gt;&lt;?php echo $p; ?&gt;&lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; &lt;/p&gt; &lt;/div&gt; &lt;div id="question_text"&gt; &lt;a href="#" onclick="showTextBox(&lt;?php echo $j+1; ?&gt;)"&gt;&lt;p id="q_original_&lt;?php echo $j+1; ?&gt;"&gt;&lt;?php echo $data_array_ques[$j]['ques_text']; ?&gt;&lt;/p&gt;&lt;/a&gt; &lt;p id="q_text_box_&lt;?php echo $j+1; ?&gt;" style="display:none;"&gt;&lt;textarea id="ques_text" name="ques_text" rows="3" cols="30"&gt;&lt;?php echo $data_array_ques[$j]['ques_text']; ?&gt;&lt;/textarea&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="menu_block"&gt; &lt;a href="" onclick="document.myform.submit()"&gt;Save Changes&lt;/a&gt; | &lt;a href="delete_question.php?project=&lt;?php echo $project_id; ?&gt;&amp;module=&lt;?php echo $module_id; ?&gt;"&gt;Delete This Question&lt;/a&gt; &lt;/div&gt; &lt;/form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload