dbriver Posted February 24, 2009 Share Posted February 24, 2009 Hello, I have a script that is working finally and is sending the proper information that is submitted in the form to me.But I am having a problem getting the ID of the text fields to come through to me. And I have about a dozen different text field like name, state, zip, phone and so on.Any help would be wonderfulThank youDavid B Link to comment Share on other sites More sharing options...
zachary Posted February 24, 2009 Share Posted February 24, 2009 Could you post the form code and the processor code? Link to comment Share on other sites More sharing options...
dbriver Posted February 25, 2009 Author Share Posted February 25, 2009 Here is the sent script<?phpif ($_POST['send']) { $errors = array(); if ($_POST['captcha'] != $_SESSION['captchacode']) { $errors[] = "You did not enter the letters shown in the image."; } if (!count($errors)) { // IMPORTANT: If you don't call this the // user will keep getting the SAME code! captchaDone(); $subject = $_POST['subject']; $detail = $_POST['detail']; mail($myaddress, 'Contact Form Submission', $subject, $detail); // Notice we can shift in and out of "HTML mode" // to display some HTML only when the // user passes the test?>David Link to comment Share on other sites More sharing options...
Wander Posted February 25, 2009 Share Posted February 25, 2009 But I am having a problem getting the ID of the text fieldsAre you sure you are giving the inputs a name-attribute instead of an id-attribute?as zachary said, can you post the html-form here too? Link to comment Share on other sites More sharing options...
justsomeguy Posted February 25, 2009 Share Posted February 25, 2009 mail($myaddress, 'Contact Form Submission', $subject, $detail);The 4 parameters to the mail function are the "to" address, the subject, the body, and extra headers, such as "from", "cc", "reply-to", etc. You are using the $subject variable as the email body, and the $detail variable as the headers. You don't just tack on extra variables if you want them to show up in the email, the entire email body is a single variable (the third one, where you have $subject). Check the mail reference to see how to use it different ways:http://www.php.net/manual/en/function.mail.php Link to comment Share on other sites More sharing options...
dbriver Posted February 25, 2009 Author Share Posted February 25, 2009 Here is the complete page<?php// Always at the VERY TOP of the page.// The opening php tag above has to be the// VERY FIRST thing in your page, NO blank lines,// no NOTHING EVER, or it will NOT work. Yes, really!require 'captcha.php';// Now $captchaimg and $captchawav are set and we can introduce // those links wherever we like in the page. We can also// access the captcha code as $_SESSION['captchacode']// and verify what the user enters in our form, as shown// below.// Where to send the messages users enter in the contact form// (change to your address if you really use this)$myaddress = 'david@cyberriver.com';?><?phpif ($_POST['send']) { $errors = array(); if ($_POST['captcha'] != $_SESSION['captchacode']) { $errors[] = "You did not enter the letters shown in the image."; } if (!count($errors)) { // IMPORTANT: If you don't call this the // user will keep getting the SAME code! captchaDone(); $subject = $_POST['subject']; $detail = $_POST['detail']; mail($myaddress, 'Contact Form Submission', $subject, $detail); // Notice we can shift in and out of "HTML mode" // to display some HTML only when the // user passes the test?><html><head><title>Message Sent</title><meta HTTP-EQUIV="REFRESH" content="0; url=http://www.ndcks.com/thankyou.html"></head><body></body></html><?php // Exit now to prevent the original form from // appearing again exit(0); }}?><html><head><title>Contact Us</title></head><body><h1>Contact Us</h1><?phpif (isset($errors)) { foreach ($errors as $error) { echo("<p>$error<p>\n"); }}?><p><form method="POST" action="<?php echo $SERVER['SCRIPT_URL']?>"> <p><b>Verification Code</b><p>To prove you are a human being, you must enter the lowercase letters shownbelow in the field on the right. Thank you for your understanding!<p><img style="vertical-align: center" src="<?php echo captchaImgUrl()?>"> <input name="captcha" size="8"/> <a href="<?php echo captchaWavUrl()?>">Listen To This</a><p>Please enter your message in the text field below. Then click"Send Your Information."<p><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td width="16%">Subject</td><td width="2%">:</td><td width="82%"><input name="subject" type="text" id="subject" size="50"></td></tr><tr><td>Detail</td><td>:</td><td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td></tr><tr><td>Name</td><td>:</td><td><input name="name" type="text" id="name" size="50"></td></tr><tr><td>Email</td><td>:</td><td><input name="customer_mail" type="text" id="customer_mail" size="50"></td></tr><tr><td> </td><td> </td></tr></table><p><input type="submit" name="send" value="Send Your Information"/></form></body></html>David Link to comment Share on other sites More sharing options...
justsomeguy Posted February 25, 2009 Share Posted February 25, 2009 Check the reference page for the mail function, that's where your problem is. You're just not using mail correctly. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.