Note that there are some explanatory texts on larger screens.

plurals
  1. POdouble form refresh
    primarykey
    data
    text
    <p>I'm new to PHP and Javascript, and just starting a website that will have two forms, one form with 5 checkboxes, and one with 5 radiobuttons. When you change the radiobuttons selected radiobutton it refreshes the page and uses the new value. The same with the checkboxes. Unfortunately, if you change one of the forms, and then change another form, the 1st forms value will no longer be there. </p> <p>Here's the code:</p> <pre><code>&lt;form name='form2' method='post'&gt; &lt;input type="radio" name="group1" value="all" onClick="if (this.checked) this.form.submit();" &lt;?php if ($_REQUEST['group1'] == null || $_REQUEST['group1'] == "all"){ echo "checked='checked'";}?&gt;/&gt; All&lt;br&gt; &lt;input type="radio" name="group1" value="Example" onClick="if (this.checked) this.form.submit();" &lt;?php if ($_REQUEST['group1'] == "Example"){ echo "checked='checked'";}?&gt;/&gt; Example&lt;br&gt; &lt;input type="radio" name="group1" value="clifton" onClick="if (this.checked) this.form.submit();" &lt;?php if ($_REQUEST['group1'] == "clifton"){ echo "checked='checked'";}?&gt;/&gt; Clifton&lt;br/&gt; &lt;input type="radio" name="group1" value="fruita" onClick="if (this.checked) this.form.submit();" &lt;?php if ($_REQUEST['group1'] == "fruita"){ echo "checked='checked'";}?&gt;/&gt; Fruita&lt;br/&gt; &lt;input type="radio" name="group1" value="loma" onClick="if (this.checked) this.form.submit();" &lt;?php if ($_REQUEST['group1'] == "loma"){ echo "checked='checked'";}?&gt;/&gt; Loma&lt;br/&gt; &lt;/form&gt; &lt;form name='form3' method='post'&gt; &lt;input type="checkbox" name="option1" value="smoking" onClick="if (this.checked) this.form.submit();" &lt;?php if(isset($_REQUEST['option1'])){ echo "checked='checked'";} ?&gt;/&gt; No Smoking&lt;br&gt; &lt;input type="checkbox" name="option2" value="kids" onClick="if (this.checked) this.form.submit();" &lt;?php if(isset($_REQUEST['option2'])){ echo "checked='checked'";} ?&gt;/&gt;Good for Kids&lt;br&gt; &lt;input type="checkbox" name="option3" value="wheelchair" onClick="if (this.checked) this.form.submit();" &lt;?php if(isset($_REQUEST['option3'])){ echo "checked='checked'";} ?&gt;/&gt;Wheelchair Accessible&lt;br&gt; &lt;input type="checkbox" name="option4" value="alcohol" onClick="if (this.checked) this.form.submit();" &lt;?php if(isset($_REQUEST['option4'])){ echo "checked='checked'";} ?&gt;/&gt;Serves Alcohol&lt;br&gt; &lt;input type="checkbox" name="option5" value="delivery" onClick="if (this.checked) this.form.submit();" &lt;?php if(isset($_REQUEST['option5'])){ echo "checked='checked'";} ?&gt;/&gt;Delivery Servicee&lt;br&gt; &lt;/form&gt; </code></pre> <p>I'm trying to get both forms input to be preserved even when the other form changes. Any help will be GLADLY appreciated. Thanks!</p>
    singulars
    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.
 

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