troll2555 Posted August 11, 2006 Share Posted August 11, 2006 Can some one PLEASE tell me why this php script won't run on my siteYou can see the html at http://www.vmwarts.com/we_buy_Form.htmHere's the php I am using....<?php// Website Contact Form Generator // http://www.tele-pro.co.uk/scripts/contact_form/ // This script is free to use as long as you // retain the credit link // get posted data into local variables$EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "sales@vmwarts.com";$Subject = "I want to sell a book";$LastName = Trim(stripslashes($_POST['LastName'])); $FirstName = Trim(stripslashes($_POST['FirstName'])); $Street1 = Trim(stripslashes($_POST['Street1'])); $City = Trim(stripslashes($_POST['City'])); $State = Trim(stripslashes($_POST['State'])); $Province = Trim(stripslashes($_POST['Province'])); $Country = Trim(stripslashes($_POST['Country'])); $HomeTel = Trim(stripslashes($_POST['HomeTel'])); $Title = Trim(stripslashes($_POST['Title'])); $Author = Trim(stripslashes($_POST['Author'])); $Publisher = Trim(stripslashes($_POST['Publisher'])); $Date = Trim(stripslashes($_POST['Date'])); $Cover = Trim(stripslashes($_POST['Cover'])); $Price = Trim(stripslashes($_POST['Price'])); $Condition = Trim(stripslashes($_POST['Condition'])); // validation$validationOK=true;if (Trim($EmailFrom)=="") $validationOK=false;if (Trim($LastName)=="") $validationOK=false;if (Trim($FirstName)=="") $validationOK=false;if (Trim($Country)=="") $validationOK=false;if (Trim($Title)=="") $validationOK=false;if (Trim($Author)=="") $validationOK=false;if (Trim($Publisher)=="") $validationOK=false;if (Trim($Date)=="") $validationOK=false;if (!is_numeric($Date)) $validationOK=false;if (Trim($Cover)=="") $validationOK=false;if (Trim($Price)=="") $validationOK=false;if (!is_numeric($Price)) $validationOK=false;if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit;}// prepare email body text$Body = "";$Body .= "LastName: ";$Body .= $LastName;$Body .= "\n";$Body .= "FirstName: ";$Body .= $FirstName;$Body .= "\n";$Body .= "Street1: ";$Body .= $Street1;$Body .= "\n";$Body .= "City: ";$Body .= $City;$Body .= "\n";$Body .= "State: ";$Body .= $State;$Body .= "\n";$Body .= "Province: ";$Body .= $Province;$Body .= "\n";$Body .= "Country: ";$Body .= $Country;$Body .= "\n";$Body .= "HomeTel: ";$Body .= $HomeTel;$Body .= "\n";$Body .= "Title: ";$Body .= $Title;$Body .= "\n";$Body .= "Author: ";$Body .= $Author;$Body .= "\n";$Body .= "Publisher: ";$Body .= $Publisher;$Body .= "\n";$Body .= "Date: ";$Body .= $Date;$Body .= "\n";$Body .= "Cover: ";$Body .= $Cover;$Body .= "\n";$Body .= "Price: ";$Body .= $Price;$Body .= "\n";$Body .= "Cover: ";$Body .= $Cover;$Body .= "\n";$Body .= "Condition: ";$Body .= $Condition;$Body .= "\n";// send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");// redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=ThankYou.htm\">";}else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";}?> Quote Link to comment Share on other sites More sharing options...
Chetan Posted August 11, 2006 Share Posted August 11, 2006 Why are you trimming twice?and you sure have a really difficult, complicated way of writing PHP Quote Link to comment Share on other sites More sharing options...
xAtlas Posted August 11, 2006 Share Posted August 11, 2006 what happens when you test the script? Are you getting errors? If so, can you post them? Quote Link to comment Share on other sites More sharing options...
troll2555 Posted August 11, 2006 Author Share Posted August 11, 2006 I'm not getting errors per sewhen i post it via the web page, it goes to the contact5.php and shows a blank page and nothing comes across via the email.. Quote Link to comment Share on other sites More sharing options...
xAtlas Posted August 11, 2006 Share Posted August 11, 2006 You do have a thankyou.html page right? Quote Link to comment Share on other sites More sharing options...
troll2555 Posted August 11, 2006 Author Share Posted August 11, 2006 I do...ThankYou.htm Quote Link to comment Share on other sites More sharing options...
troll2555 Posted August 11, 2006 Author Share Posted August 11, 2006 I am actually only trying to do what I initally thought was a simple contact form on my web page. There are thousands of contact me pages out there, but I can't seem to find any that will either work on my site. For some reason, this has become immensely complicated. Research 'seemed" to indicate that php was the only way to go on this as a simple email me would not give my customer the ability to see what information I needed to make an offer to buy his book.Please, someone tell me how to beat this thing. It is the last item I need so I can get back to the business of selling books, and out of the part about web page building.Yes, I am begging here for help, but I have been working on this for a week now and it is draining me. Quote Link to comment Share on other sites More sharing options...
xAtlas Posted August 11, 2006 Share Posted August 11, 2006 [quote author=troll2555 link=topic=103874.msg414093#msg414093 date=1155322071]I do...ThankYou.htm[/quote]Is the the ThankYou.htm in the home directory of the script?Can you do me a favor? post the HTM portion of this script. Make sure that this is correct:[code]<form method="POST" action="contact.php">[/code]action="contact.php" or whatever you named the PHP file to. I just tested this and it works fine now. It did the same thing as your because the 'action=' wasn't contact.php (which is what I had generated). Quote Link to comment Share on other sites More sharing options...
troll2555 Posted August 11, 2006 Author Share Posted August 11, 2006 changed to full url on them and tried again still get a blank page pointing to http://www.vmwarts.com/contact5.php Quote Link to comment Share on other sites More sharing options...
xAtlas Posted August 11, 2006 Share Posted August 11, 2006 Can you do me a favor? post the HTM portion of this script. Make sure that this is correct:[code]<form method="POST" action="contact.php">[/code]action="contact.php" or whatever you named the PHP file to. I just tested this and it works fine now. It did the same thing as your because the 'action=' wasn't contact.php (which is what I had generated). Quote Link to comment Share on other sites More sharing options...
troll2555 Posted August 12, 2006 Author Share Posted August 12, 2006 OkayHere's the html portion of the Form page<form method="POST" action="http://www.vmwarts.com/contact5.php"><p><font size="2">Your Email:* <br></font><input type="text" name="EmailFrom" size="20"><font size="2"> </font><p><font size="2">Last Name:* <br></font><input type="text" name="LastName" size="20"><font size="2"> </font><p><font size="2">First Name:* <br></font><input type="text" name="FirstName" size="20"><font size="2"> </font><p><font size="2">Street:<br></font><input type="text" name="Street1" size="20"><font size="2"> </font><p><font size="2">City:<br></font><input type="text" name="City" size="20"><font size="2"> </font><p><font size="2">State:<br></font><input type="text" name="State" size="20"><font size="2"> </font><p><font size="2">Province:<br></font><input type="text" name="Province" size="20"><font size="2"> </font><p><font size="2">Country:* <br></font><input type="text" name="Country" size="20"><font size="2"> </font><p><font size="2">Home Phone:<br></font><input type="text" name="HomeTel" size="20"><font size="2"> </font><p> <p><b><span class="tiny"><font face="Verdana" size="2" color="#800000">Information About Your Book:<br></font></span></b><font face="Verdana" size="2">Fields marked (*) are required</font><p> <p><font size="2">Title:* <br></font><input type="text" name="Title" size="20"><font size="2"> </font><p><font size="2">Author:* <br></font><input type="text" name="Author" size="20"><font size="2"> </font><p><font size="2">Publisher:* <br></font><input type="text" name="Publisher" size="20"><font size="2"> </font><p><font size="2">Date:* <br></font><input type="text" name="Date" size="20"><font size="2"><p><p><font size="2">Cover:* <br></font><select size="1" name="Cover"><option>Leather</option><option>Cloth</option><option>Paper Wraps</option><option>Other</option></select><font size="2"> </font><p>Price:* <br><input type="text" name="Price" size="20"><font size="2"> </font><p><font size="2">Condition:<br></font><input type="text" name="Condition" size="20"><font size="2"> </font><p style="text-align: center"><input type="submit" name="submit" value="Submit"></form> Quote Link to comment Share on other sites More sharing options...
troll2555 Posted August 12, 2006 Author Share Posted August 12, 2006 and here is the php file<?php// Website Contact Form Generator // http://www.tele-pro.co.uk/scripts/contact_form/ // This script is free to use as long as you // retain the credit link // get posted data into local variables$EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "sales@vmwarts.com";$Subject = "I want to sell a book";$LastName = Trim(stripslashes($_POST['LastName'])); $FirstName = Trim(stripslashes($_POST['FirstName'])); $Street1 = Trim(stripslashes($_POST['Street1'])); $City = Trim(stripslashes($_POST['City'])); $State = Trim(stripslashes($_POST['State'])); $Province = Trim(stripslashes($_POST['Province'])); $Country = Trim(stripslashes($_POST['Country'])); $HomeTel = Trim(stripslashes($_POST['HomeTel'])); $Title = Trim(stripslashes($_POST['Title'])); $Author = Trim(stripslashes($_POST['Author'])); $Publisher = Trim(stripslashes($_POST['Publisher'])); $Date = Trim(stripslashes($_POST['Date'])); $Cover = Trim(stripslashes($_POST['Cover'])); $Price = Trim(stripslashes($_POST['Price'])); $Condition = Trim(stripslashes($_POST['Condition'])); // validation$validationOK=true;if (Trim($EmailFrom)=="") $validationOK=false;if (Trim($LastName)=="") $validationOK=false;if (Trim($FirstName)=="") $validationOK=false;if (Trim($Country)=="") $validationOK=false;if (Trim($Title)=="") $validationOK=false;if (Trim($Author)=="") $validationOK=false;if (Trim($Publisher)=="") $validationOK=false;if (Trim($Date)=="") $validationOK=false;if (!is_numeric($Date)) $validationOK=false;if (Trim($Cover)=="") $validationOK=false;if (Trim($Price)=="") $validationOK=false;if (!is_numeric($Price)) $validationOK=false;if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit;}// prepare email body text$Body = "";$Body .= "LastName: ";$Body .= $LastName;$Body .= "\n";$Body .= "FirstName: ";$Body .= $FirstName;$Body .= "\n";$Body .= "Street1: ";$Body .= $Street1;$Body .= "\n";$Body .= "City: ";$Body .= $City;$Body .= "\n";$Body .= "State: ";$Body .= $State;$Body .= "\n";$Body .= "Province: ";$Body .= $Province;$Body .= "\n";$Body .= "Country: ";$Body .= $Country;$Body .= "\n";$Body .= "HomeTel: ";$Body .= $HomeTel;$Body .= "\n";$Body .= "Title: ";$Body .= $Title;$Body .= "\n";$Body .= "Author: ";$Body .= $Author;$Body .= "\n";$Body .= "Publisher: ";$Body .= $Publisher;$Body .= "\n";$Body .= "Date: ";$Body .= $Date;$Body .= "\n";$Body .= "Cover: ";$Body .= $Cover;$Body .= "\n";$Body .= "Price: ";$Body .= $Price;$Body .= "\n";$Body .= "Cover: ";$Body .= $Cover;$Body .= "\n";$Body .= "Condition: ";$Body .= $Condition;$Body .= "\n";// send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");// redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.vmwarts.com/ThankYouOffer.htm\">";}else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.vmwarts.com/error.htm\">";}?> Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 12, 2006 Share Posted August 12, 2006 Uploaded both your files to my server. It works perfectly and sends me the email message.There's something wrong with the mail set-up on your server. Contact your hosting service provider and ask. 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.