Jump to content

can't get this script to run


troll2555

Recommended Posts

Can some one PLEASE tell me why this php script won't run on my site

You can see the html at http://www.vmwarts.com/we_buy_Form.htm


Here'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\">";
}
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

[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).
Link to comment
Share on other sites

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).
Link to comment
Share on other sites

Okay

Here'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>&nbsp;<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>&nbsp;<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>
Link to comment
Share on other sites

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\">";
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.