freaksilver Posted June 8, 2009 Share Posted June 8, 2009 Hi, New to php and this forum. I am having a hell of a time simply editing an existing php form mail script to display my own fields. The form emails to me with all of the text portions intact, ex. "From:" but the field information doesn't come through at all. I created my own .html file with the form inset - it's possible that this is where the problem occurs. Any help would be GREATLY appreciated. I've been banging my head against a wall for a few hours now. the php: <?php ################################################## ## Email sender by: Steve "Defender" Cunningham ## ################################################## ## ## ## Edit the proper variables to make the script ## ## work on your site. ## ## ## ################################################## ## ## ## If I'm not busy, you can email me at: ## ## sc_99_99@yahoo.com and I can try to help ## ## you with your problem. ## ## ## ################################################## ## ## ## Note that if the copyright info is deleted, ## ## this script is no longer valid. ## ## ## ################################################## //Define some variables $youremail="****@****.ca"; // This is the address that the information submitted will be sent to. $emailsubject="Contact form info!"; // This will the email's subject // The From field will be be where this email came from. // Note on the from field. the text after the first " mark, until the < is what appears in "From" in your email program. // So, you can put anything alpha numeric here. That would be any letters A-Z and a-z, as well as 0-9 $from_who="My Site's Contact Form <youremail@yoursite.com>"; $pagetitle="Thank You!"; // Title to be displayed on the sent info page. // Enter the code that you want to appear before the information submitted. // Make sure you put a / mark before all double quotation marks or the script won't work. // the \n at the end of the line is to create a new line in the HTML SOURCE. It DOES NOT create a break or new line // when viewing it on the internet. Put these at the end of each line in the header and footer if you wish. // They aren't required. $header = "<!-- Begin Header -->\n <table>\n <tr>\n <td bgcolor=\"000000\"><font color=\"FFFFFF\" size=\"2\" face=\"verdana\">\n <!-- End Header -->\n"; // Enter the code you'd like displayed after the information submitted. // Make sure you put a / mark before all double quotation marks or the script won't work. // the \n at the end of the line is to create a new line in the HTML SOURCE. It DOES NOT create a break or new line // when viewing it on the internet. Put these at the end of each line in the header and footer if you wish. // They aren't required. $footer = "<!-- Begin Footer -->\n </td></tr></table>\n <!-- End Footer -->\n"; // This code gets the ip address of the person submiting the form. // You shouldn't remove it if you want to use this feature. if (getenv(HTTP_CLIENT_IP)){ $user_ip=getenv(HTTP_CLIENT_IP); } else { $user_ip=getenv(REMOTE_ADDR); } // If your server uses php version 4.2 or above, you can leave this section alone. // Otherwise, add 2 slashes (//) to the beginning of the following 4 lines and delete the // in the section below. $firstname = $_POST['email'] ; $lastname = $_POST['lastname'] ; $birthdate = $_POST['birthdate'] ; $sn = $_POST['sn'] ; $addy = $_POST['addy'] ; $city = $_POST['city'] ; $pcode = $_POST['pcode'] ; $yrs = $_POST['yrs'] ; $mths = $_POST['mths'] ; $homeph = $_POST['homeph'] ; $cellph = $_POST['cellph'] ; $email = $_POST['email'] ; $employer = $_POST['employer'] ; $empph = $_POST['empph'] ; $yrs2 = $_POST['yrs2'] ; $mths2 = $_POST['mths2'] ; $jobtitle = $_POST['jobtitle'] ; $income = $_POST['income'] ; $vehicle = $_POST['vehicle'] ; //$firstname = $_POST['firstname']; //$email = $_POST['email']; //$url = $_POST['url']; //$comments = $_POST['url']; // Edit the following lines to customize how the email sent to you will look. // To add more fields, just copy and paste the line, and edit the info between the " marks. // The last 2 lines will send the users browser information and their ip number with the mail. // Just in case. $mailbody.="First Name: $firstname\n"; $mailbody.="Last Name: $lastname \n"; $mailbody.="Birthdate: $birthdate \n"; $mailbody.="SIN #: $sn \n"; $mailbody.="Address: $addy \n"; $mailbody.="City: $city \n"; $mailbody.="Postal Code: $pcode \n"; $mailbody.="Years at Residence: $yrs \n"; $mailbody.="Months at Residence: $mths \n"; $mailbody.="Home Phone: $homeph \n"; $mailbody.="Cell Phone: $cellph \n"; $mailbody.="Email: $email \n"; $mailbody.="Employer: $employer \n"; $mailbody.="Employer Phone: $empph \n"; $mailbody.="Years with Employer: $yrs2 \n"; $mailbody.="Months with Employer: $mths2 \n"; $mailbody.="Job Title: $jobtitle \n"; $mailbody.="Monthly Income: $income \n"; $mailbody.="Vehicle Type: $vehicle \n"; mail("$youremail", "$emailsubject", "$mailbody", "From: $from_who"); // Send the email. $comments = nl2br($comments); // Page HTML comes next. ?> <html> <head> <title><?php $pagetitle ?></title> </head> <body> <?php print $header; // A note about the following. // Each of the printed values here correspond to a field in the form. // Change this area if you change what fields are in the form. ?> Submitted information:<br><br> Name: <?php print $firstname; ?><br> Your email address is <a href="mailto:<?php print $email; ?>"><?php print $email; ?></a><br> The URL submitted is <a href="<?php print $url; ?>"><?php print $url; ?></a><br> The comments you submitted are: <?php print $comments; ?><br> <?php print $footer; ?> <!-- DO NOT EDIT BELOW THIS LINE. --> <!-- DO NOT EDIT BELOW THIS LINE. --> <?php // This is a free script, PLEASE leave my copyright notice. $date=date("Y"); if ($date==2001){ echo "<br>\n<font size=\"1\" face=\"verdana\">\nThis script is Copyright ©"; echo (date("Y")); echo " Steven \"<a href=\"mailto:****@****.net\">Defender</a>\" Cunningham\n"; } else { print "<br>\n<font size=\"1\" face=\"verdana\">\nThis script is Copyright © 2001-"; print (date("Y")); print " Steven \"<a href=\"mailto:****@****.net\">Defender</a>\" Cunningham\n"; } ?> <!-- DO NOT EDIT THE ABOVE LINES --> <!-- DO NOT EDIT THE ABOVE LINES --> </body> </html> the html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Top Gun Auto Credit</title> <link href="file:///D|/Projects/RCM Auto/site.css" rel="stylesheet" type="text/css" /> </head> <body class="oneColFixCtrHdr"> <div id="header"> <img src="file:///D|/Projects/RCM Auto/images/topgun-logo.jpg" width="780" height="180" /> <!-- end #header --></div> <div id="container"> <div id="navbox"> <ul id="navbar"> <li>HOME</li> <li>INVENTORY</li> <li>APPLY NOW</li> <li><a href="mailto:****@****.com">EMAIL ME</a></li> </ul> </div> <div id="mainContent"> <form action="test.php" method"post"> <fieldset> <legend>Top Gun Auto Credit Application Form</legend> <p><b>Section 1 - Personal Information</b></p> <p>First Name<br /> <input type="text" name="firstname" value="" id="firstname" size="40" maxsize="40" /> </p> <p><label for="lastname">Last Name</label><br /> <input type="text" name="lastname" value="" id="lastname" size="40" maxsize="40"></p> <p><label for="birthdate">Birth Date</label><br /> <input type="text" name="birthdate" value="" id="birthdate" size="20" maxsize="20"></p> <p><label for="sn">Social Insurance #</label><br /> <input type="text" name="sn" value="" id="sn" size="20" maxsize="20"></p> <p><b>Section 2 - Residential Information</b></p> <p><label for="addy">Present Address</label><br /> <input type="text" name="addy" value="" id="addy" size="40" maxsize="40"></p> <p><label for="city">City</label><br /> <input type="text" name="city" value="" id="city" size="40" maxsize="40"></p> <p><label for="pcode">Postal Code</label><br /> <input type="text" name="pcode" value="" id="pcode" size="15" maxsize="15"></p> <p>Time at Residence<br /><input type="text" name="yrs" value="" id="yrs" size="15" maxsize="15"><label for="yrs"> years </label><input type="text" name="mths" value="" id="mths" size="15" maxsize="15"><label for="mths"> months</label></p> <p><label for="homeph">Home Phone #</label><br /> <input type="text" name="homeph" value="(780)" id="homeph" size="20" maxsize="20"></p> <p><label for="cellph">Cell Phone #</label><br /> <input type="text" name="cellph" value="(780)" id="cellph" size="20" maxsize="20"></p> <p><label for="email">Email</label><br /> <input type="text" name="email" value="" id="email" size="40" maxsize="40"></p> <p><b>Section 3 - Employment Information</b></p> <p><label for="employer">Employer</label><br /> <input type="text" name="employer" value="" id="employer" size="40" maxsize="40"></p> <p><label for="empph">Employer Phone Number</label><br /> <input type="text" name="empph" value="(780)" id="empph" size="20" maxsize="20"></p> <p><label for="jobtitle">Job Title / Occupation</label><br /> <input type="text" name="jobtitle" value="" id="jobtitle" size="40" maxsize="40"></p> <p>Time with Current Employer<br /><input type="text" name="yrs" value="" id="yrs" size="15" maxsize="15"><label for="yrs2"> years </label><input type="text" name="mths" value="" id="mths2" size="15" maxsize="15"><label for="mths"> months</label></p> <p><label for="income">Monthly Income (before taxes and deductions)</label><br /> <input type="text" name="income" value="" id="income" size="20" maxsize="20"></p> <p><label for="vehicle">Are you interested in a new or used vehicle?</label><br /> <input type="radio" name="vehicle" value="new" /> New <input type="radio" name="vehicle" value="used" /> Used</p> <p><input id="submit" type="submit" name="submit" value="Submit Application"> <b>(Please click submit only once)</b></p> Once your application has been reviewed, a member of our finance department will contact you with the financing options available to you. Thank you for your interest in us - we look forward to helping you. </fieldset> </p> </form> <div class="clrfloat"></div> <!-- end #mainContent --></div> <div id="footer"> <p class="alignlft">Home | Inventory | Apply Now | Email Me</p> <p class="alignrt">Website by <a href="http://embryomediaproductions.com">Embryo Media Productions</a> <!-- end #footer --></div> <!-- end #container --></div> </body> </html> Thanks in advance... Celeste Quote Link to comment Share on other sites More sharing options...
gevans Posted June 8, 2009 Share Posted June 8, 2009 <form action="test.php" method="post"> missing equals Quote Link to comment Share on other sites More sharing options...
freaksilver Posted June 8, 2009 Author Share Posted June 8, 2009 WHAT! omg.. you've gotta be kidding me. I sure feel like a fool now. haha thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.