Hi all, this is another newbie crying out for help after several hours of looking alot of coding and not being able to understand a thing!
I've basically created a simple email form in html and used php scripting to send the form to my email...now..I thought I should inlcude more options in this form to filter out some data I'm collecting in my emails. So i've now included some radio buttons and drop down list/menu.
I've entered all the values and labels, the main question is how do I get the form to send the selected values along with the usual info i.e. name, address, email etc to my email?
I've included my existing form I wish to update if it's any help! 😃
<?
$mailto = 'john@something.co.uk' ;
$subject = "Feedback Form" ;
$formurl = "http://www.something.co.uk/contact.html" ;
$errorurl = "http://www.something.co.uk/error.html" ;
$thankyouurl = "http://www.something.co.uk/thanks.html" ;
$uself = 0;
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );
if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
header( "Location: $errorurl" );
exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}
if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}
$messageproper =
"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;
mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;
?>