vendredi 13 mai 2016

Putting checkbox values into a variable with PHP BEFORE form being submitted

I have a series of simple checkboxes.

<select>
    <option class="menuoption2" value="gold">Gold</option>
    <option class="menuoption2" value="silver">Silver</option>
    <option class="menuoption2" value="bronze">Bronze</option>
</select>

I want to get only the checked ones into a PHP variable. However note there is no Submit button. This is on purpose and not allowed by the brief i have been given; my variables' values have to be on display in a simple <div> as soon as the checkboxes are clicked. I cannot have the page refreshed either. I know I can use $_POST - but only if i could submit anything and also I could use jQuery (indeed i have done this before) to do this but ultimately I need those values in that PHP variable, not a JS variable. Any ideas?




Aucun commentaire:

Enregistrer un commentaire