vendredi 18 octobre 2019

default value of checkbox in php

I've a checkboxes with different symptoms: http://dentopolis.org/test/ I'd like some checkboxes to be checked as default (like "no toothpain") and then user can change it's value once again. how can I do that? my current code:

$hiv=$_SESSION['hiv'] = $_GET['hiv'];

if ($_GET['hiv']=='on') {
echo "<span class='czerwony'> HIV </span> <input type='checkbox' name='hiv' checked>; ";
}
else {
echo "HIV <input type='checkbox' name='hiv'> ; ";
}

later I will change GET to POST




Aucun commentaire:

Enregistrer un commentaire