onei0120 Posted July 6, 2009 Share Posted July 6, 2009 Hello, i am trying to send a form by email on submit with multiple text fields, a radio button, and a checkbox i would like to know how to send the values of checkboxes and radio buttons. second of all when i try to put more than five variables in the sending line of the script i get the massage a cant put in more than 5.... this is my script <?php $to = "****EMAIL*******"; $subject = "Contest Entry"; $Age = $_REQUEST['age'] ; $FirstName = $_REQUEST['first_name'] ; $LastName = $_REQUEST['last_name'] ; $sent = mail($to, $subject, $Age, $FirstName, $LastName); if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> Link to comment https://forums.phpfreaks.com/topic/165005-send-more-than-5-values-in-a-form-on-submit/ Share on other sites More sharing options...
p2grace Posted July 7, 2009 Share Posted July 7, 2009 Could you also post the form that submits data to this script? Link to comment https://forums.phpfreaks.com/topic/165005-send-more-than-5-values-in-a-form-on-submit/#findComment-870125 Share on other sites More sharing options...
clearmedia Posted July 7, 2009 Share Posted July 7, 2009 when using the mail() function it must be in the form of mail($to, $subject, $message, $headers) where $headers are optional. Your $to and $subject are fine, but you can't include Age, FirstName, LastName as you have them. Instead, put them into your $message variable. <?php $to = "****EMAIL*******"; $subject = "Contest Entry"; $Age = $_REQUEST['age'] ; $FirstName = $_REQUEST['first_name'] ; $LastName = $_REQUEST['last_name'] ; $message=$age." ".$FirstName." ".$LastName; $sent = mail($to, $subject, $message); if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> This will send an email to $email with a subject $subject and the email itself will be Age FirstName LastName Link to comment https://forums.phpfreaks.com/topic/165005-send-more-than-5-values-in-a-form-on-submit/#findComment-870130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.