lundi 4 février 2019

Input value not being retrieved

PHP variable won't return the POST value of a checkbox; it says the variable is undefined

I then try to insert the POST data into my database, but to no avail.

Tried retrieving with a PHP variable; tried changing the checkbox to a radiobutton (same issue); tried moving the checkbox elsewhere

<label><input type="checkbox" name="farming_type" value="1" >Organic</label><br />
<label><input type="checkbox" name="grazing_type" value="2" />Grass-fed</label>
<label><input type="checkbox" name="antibiotics" value="3" />Antibiotic-free</label><br />
<label><input type="checkbox" name="hormones" value="4" />Hormone-free</label>

$farming_type = $_POST["farming_type"];

Expected: a returned variable. Actual: empty variable




Aucun commentaire:

Enregistrer un commentaire