Note that there are some explanatory texts on larger screens.

plurals
  1. POremembering checkboxes for session
    primarykey
    data
    text
    <p>I have some checkboxes like this:</p> <pre><code>&lt;input type="checkbox" name="regions[]" value="north-east" /&gt;North East&lt;br /&gt; &lt;input type="checkbox" name="regions[]" value="north-west" /&gt;North West&lt;br /&gt; &lt;input type="checkbox" name="regions[]" value="east-midlands" /&gt;East Midlands&lt;br /&gt; &lt;input type="checkbox" name="regions[]" value="west-midlands" /&gt;West Midlands&lt;br /&gt; &lt;input type="checkbox" name="regions[]" value="south-east" /&gt;South East&lt;br /&gt; &lt;input type="submit" name="selectionsSubmit" value="Submit" /&gt; </code></pre> <p>Names and values can not be set differently, because I am using it for this php code:</p> <pre><code>if(isset($_POST['selectionsSubmit'])) { $regions=$_POST["regions"]; $how_many=count($regions); if($how_many&gt;0) { $link=home_url('/') ."?tag="; if($how_many!=12 &amp;&amp; $how_many!=0) { for($i=0; $i&lt;$how_many; $i++) { $link=$link ."+". $regions[$i]; } } wp_redirect($link); } else { echo 'You did not select anything.'; }} </code></pre> <p>It generates a tag link and redirects to that link. This is my first php code ever, and I should mention that I use wordpress.</p> <p>Now I need a way to make selected checkboxes to be remembered for a session... until the user closes the site. I found many ways how to accomplish this, but I couldn't make it work. I think that HTML5 <code>sessionStorage</code> might be of some use, but my lack of knowledge prevents me from finding the way.</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