Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help returning values from a checkbox

Status
Not open for further replies.

dthomas31uk

Technical User
Oct 19, 2003
107
GB
Hi, Have a webpage with a number of checkboxes on


As you can see they all start with negative values (in the checkboxes). How can I return values from the checkbox by email that the user has entered via email.

Have used the following from various form elements before as you can see from the code below, but this does not return any data from the form. Hope someone can point me in the right direction cheers guys.

<?
$option = $_POST["SalonVsPrices_Key"];
$email = $_POST["email"];
$message = $_POST["message"];
$date = date ("j m Y hh:mm", strtotime("now"));
$message = $_POST["message"];
$message = <<<EOF
Enquiry from $name \r\n
Email address: $email\r\n
Made on $date\r\n
who left the following message: \r\n
$message

EOF;

$to = "myemailaddress"; // To email address
$subject = "Enquiry from Athene Hair and Beauty Contact Page";
$headers = 'From: $to'. "\r\n" .
'Reply-To: $to' . "\r\n" .
'X-Mailer: PHP/' . phpversion();





if(mail($to, $subject, $message, $headers))
{
header("Location: ContactResponse.html");
exit;
}
else
{
echo "error in mail";
};
 
I'm not sure what your question is.

Are you getting no values from any form field in your emails?


Are you having problems with specifically checkboxes?




Want the best answers? Ask the best questions! TANSTAAFL!
 
i suggest you add a CRLF after the end of the headers.

in any event you cannot address the checkbox values through php in the way that you have created them.

instead of calling them "SalonVsPrices_Key" call them "SalonVsPrices_Key[]" and then those that are checked will be available in the array $_POST['SalonVsPrices_Key'].

even if you do this you are not providing yourself with a manner of identifying which check box relates to which item. i would have the value as some uniquely identifier from which you can look up the item and its cost.
 
Radio buttons have the same name and different values... Checkboxes have to have different names. The value can be anything you want, "yes" "on" "picked" etc. Your key/value pairs will look like:

Service1=&Service2=on&Service3=yes


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top