I created a html page with multiple checkboxes.
<input type="checkbox" name="option_one" value="YES" class='checkbox_divs' >Option one<br>
<input type="checkbox" name="option_two" value="YES" class='checkbox_divs' >Option two<br>
<input type="checkbox" name="option_three" value="YES" class='checkbox_divs' >Option Three<br>
The user submits it and a php page is called to send it to a SQL database this way :
$strSQL = "INSERT INTO CLDETAILS (option_one, option_two, option_three)
VALUES
('$_POST[option_one]','$_POST[option_two]','$_POST[option_three]')";
if (sqlsrv_query($conn,$strSQL))
{
echo "Saved !";
}
else
{
echo "Error Save [".$strSQL."]";
print_r( sqlsrv_errors());
}
?>
Everything works fine, just that I would like to emprove my code and avoid having errors like "Notice: Undefined index:...". I know that I should use "isset" but I beggin in PHP, and I don't really know how I should use it. Thanks for your help.