Checkbox Form Processing in PHP<

liunx

Guest
Hi,

Im using php to process form data and send it to me in an email. Im running into problems with the checkbox. Here is how I initalize the checkbox in my php:

$carpet = ($_POST['carpet'])?"Carpet: Yes":"Carpet: No";

and how i print it out:

$messageproper =

"--------------- MEMBER INFORMATION -------\n\n" .
$carpet .
"\n\n-------------------------------------\n" ;

When the checkbox is checked, everything works great. However, when not checked the message still sends fine, but instead of forwarding the user to the "Thank You" page, this php error is given:

Notice: Undefined index: carpet in E:\Accounts\tools4fl\scripts\register.php on line 76

Warning: Cannot modify header information - headers already sent by (output started at E:\Accounts\tools4fl\scripts\register.php:76) in E:\Accounts\tools4fl\scripts\register.php on line 115


Any suggestions? Thanks in advance!all php questions to the PHP Programming subforum pleaseI needed an "isset" in there

$carpet = ($_POST['carpet'])?"Carpet: Yes":"Carpet: No";

to

$carpet = isset($_POST['carpet'])?"Carpet: Yes":"Carpet: No";

made it work !
 
Back
Top