I got this script from this website
http://www.4serendipity.com/form/
and modified it to my needs, here is what I have...
My problem exists when I try to send it with everything entered, it tells me the first and last name are not entered please enter one, and sometimes I get an error telling me that the email was not entered, I don't know why, can someone look at it and tell me why it's doing that?Code:<? //import form information $Fname = $_POST['First Name']; $Lname = $_POST['Last Name']; $Email = $_POST['Email']; $Problem = $_POST['Problem']; $Other = $_POST['Other']; $Body = $_POST['Body']; $message=stripslashes($message); /* Simple form validation check to see if an email and message were entered */ //if no message entered and no email entered print an error if (empty($Body) && empty($Email)){ print "No email address and no message was entered. <br>Please include an email and a message"; } //if no message entered send print an error elseif (empty($Body)){ print "No message was entered.<br>Please include a message.<br>"; } //if no email entered send print an error elseif (empty($Email)){ print "No email address was entered.<br>Please include your email. <br>"; } //if no First and or Last name isn't entered, print an error elseif (empty($Fname) && empty($Lname)){ print "No First name and or Last name was entered. <br>Please include your First and Last name"; } //if the form has everything needed else { // print a response message //Thank the user by name if they entered a name if (!empty($Fname)) { print "<b>Thank you $Fname.</b><br>"; } for ($i=0;$i<count($types);$i++){ $ctypes= $ctypes . "\n$types[$i]"; $screen_ctypes= $screen_ctypes . "\n$types[$i]"; } print "<p><b>The following message has been sent</b>: <br>$Body<br></p><p><b>Comment type(s):</b><br>$screen_ctypes</p>"; $body= $Body . " \n\nComment type(s)" . $ctypes; //mail the form contents mail( "contact@newlightpages.com", "Web site comments", $body, "From: $Email" ); } ?>
Also, the part in the script from the site..
I was not able to get working, even when I put in my site location and the location of the form, it kept returning as "Invalid referrer" so I had to just take that out.Code:$page = "http://ella.slis.indiana.edu/~PATH/TO/FORM"; if (!ereg($page, $_SERVER['HTTP_REFERER'])){ echo "Invalid referer"; die; }
Thats not inportant to me atm, but I would like to get it up and working, if this is a bad script to use please direct me else where, this is the only one I could find that I understood how to use.
thanks,
-TaX



Reply With Quote

Bookmarks