Jump to content

Send more than 5 values in a form on submit!


onei0120

Recommended Posts

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"; }

?>

 

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.