Forum Moderators: coopster
I have an e-mail form which collects name, e-mail address and then a checkbox <input type="checkbox" name="checkbox" value="YES">. My PHP script e-mails me the name and e-mail fine, but not the checkbox. Any ideas what I'm doing wrong?
<?php
//create short variable names
$name=$HTTP_POST_VARS['name'];
$email=$HTTP_POST_VARS['email'];
$checkbox=$HTTP_POST_VARS['checkbox'];
$toaddress = 'myemail@example.com';
$subject = 'RESULTS';
$mailcontent = 'Name: '.$name."\n"
.'Email: '.$email."\n"
.'Checkbox: '.$checkbox."\n";
$fromaddress = 'From: myemail@example.com';
mail($toaddress, $subject, $mailcontent);
?>
It arrives blank:
Name: Their Name
Email: theiremail@example.com
Checkbox:
nb in the future try using $_POST('whatever') instead of $HTTP_POST_VARS['whatever'] if using a PHP manufactured after the industrial revolution, it'll be more future-friendly.