Note that there are some explanatory texts on larger screens.

plurals
  1. PONested Form to disable text field with selection box HTML
    primarykey
    data
    text
    <p>I have code form.html and entry.php</p> <p>First I want to disable textfield with selection box using javascript, then submit it to give an output. If i not using this code <code>&lt;form name="form1" method="post" action="entry.php"&gt;</code> form.html is success to display in web browser, but how i can submit it with one submit button?</p> <p>form.html </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="jquery.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function(){ $('.group').hide(); $('#option1').show(); $('#chooseForm').change(function() { $('.group').hide(); $('#'+$(this).val()).show(); }) }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="form1" method="post" action="entry.php"&gt; &lt;select id="chooseForm" name="select"&gt; &lt;option value="option1"&gt;Form1&lt;/option&gt; &lt;option value="option2"&gt;Form2&lt;/option&gt; &lt;option value="option3"&gt;Form3&lt;/option&gt; &lt;/select&gt; &lt;form id="option1" class="group"&gt; &lt;input name="a" value="form A"&gt;&lt;br&gt; &lt;/form&gt; &lt;form id="option2" class="group"&gt; &lt;input name="a" value="form A"&gt;&lt;br&gt; &lt;input name="b" value="form B"&gt;&lt;br&gt; &lt;/form&gt; &lt;form id="option3" class="group"&gt; &lt;input name="a" value="form A"&gt;&lt;br&gt; &lt;input name="b" value="form B"&gt;&lt;br&gt; &lt;input name="c" value="form C"&gt;&lt;br&gt; &lt;/form&gt; &lt;input value="Save" name="submit" type="submit"&gt;&lt;br&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>entry.php</p> <pre><code>&lt;?php $select = $_POST['select']; $a = $_POST['a']; $b = $_POST['b']; $c = $_POST['c']; echo $select; echo "&lt;br&gt;"; echo $a; echo "&lt;br&gt;"; echo $b; echo "&lt;br&gt;"; echo $c; ?&gt; </code></pre> <p>Can anyone solve this code without nested form? thanks :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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