This is a discussion on Undefined index in form with checkbox within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I had a form working with a couple of checkboxes using the mail() function that takes the user to a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I had a form working with a couple of checkboxes using the mail()
function that takes the user to a simple "thanks for your input" page using the header() function at the end. But, instead of this, I wanted to be able to print the results of their input. So, after the mail() part, I had replaced the header() part with print() but am getting this error now for the box that was not checked. Notice: Undefined index: bw in C:\wwwroot\test.php Here is what I had working before I changed the header() to print(): $color = $_REQUEST['color'] ; if($color == "on"){echo" CHECKED";} $bw = $_REQUEST['bw'] ; if($bw == "on"){echo" CHECKED";} I'm a little new to PHP. |
|
|||
|
socal local wrote:
> I had a form working with a couple of checkboxes using the mail() > function that takes the user to a simple "thanks for your input" page > using the header() function at the end. But, instead of this, I wanted > to be able to print the results of their input. So, after the mail() > part, I had replaced the header() part with print() but am getting this > error now for the box that was not checked. > > Notice: Undefined index: bw in C:\wwwroot\test.php > > Here is what I had working before I changed the header() to print(): > > $color = $_REQUEST['color'] ; > if($color == "on"){echo" CHECKED";} > $bw = $_REQUEST['bw'] ; > if($bw == "on"){echo" CHECKED";} > > > > > I'm a little new to PHP. > I fixed this by turning error_reporting in the php.ini file to Off. |
|
|||
|
"socal local" <coastin310@NoSpam.yahoo.com> schreef in bericht news:jPcob.862970$Pk.131134@news.easynews.com... > > > > $color = $_REQUEST['color'] ; > > if($color == "on"){echo" CHECKED";} > > $bw = $_REQUEST['bw'] ; > > if($bw == "on"){echo" CHECKED";} > > > > I fixed this by turning error_reporting in the php.ini file to Off. > That is NOT a fix! Turn error_reporting on again and use http://www.php.net/isset to see if the key exists. Example: if (isset($_REQUEST['bw']) && $_REQUEST['bw'] == "on"){echo" CHECKED";} JW |