OK here is the deal. I have an input form with check boxes. And the value that is submitted to the database has to be Yes or No. So in my php submission code I have an error checking code that says
If($blah=="") {
$blah="no"
}
however whenver I submit with blah not checked it gives me an undeclared variable warning I would like to get rid of it. Not sure if it would help but I can't change the Post to a Get because the person I am doing this for would rather not have the information in the url.
Thanks in advance,
Jeff
Undeclared Variable warnings
Moderator: General Moderators
Code: Select all
<?php
If($blah == ""){
$blah="no";
echo $blah;
}
?>It would have given a parse error if he had forgotten that semicolon - it's more likely that he just retyped a snippet of his code on-the-fly, thus disregarding perfection.
Try this instead:
Try this instead:
Code: Select all
If(!isset($blah)){
$blah="no";
}