contact form not working within Shopsite structure

General ShopSite user discussion

contact form not working within Shopsite structure

Postby Vernontnh » Wed Oct 13, 2010 7:15 am

Hi:

I have a standard form code with an corresponding contact_us.php file that resides on the server in the same folder with the contact_us.html file.

I have used this on many sites. In tests on the sites contact page, http://www.stellaandjames.com/store/contact_us.html, when you fill out the form, it does send to the specified email address.

However, whether or not you fill out the form correctly, once submitted, it goes to this page:
http://www.stellaandjames.com/store/contact.php

I think it has to do with the directories and the way shopsite set up the site, but I've tried every configuration I can think of to get the href link correct in the .php file with no success.

For example:
URL=thankyou.html\">";
}

URL=store/thankyou.html\">";
}

URL=/store/thankyou.html\">";
}

URL=http://www.stellaandjames.com/store/thankyou.html\">";
}


PLUS, every one of those without the "\" after .html in the string.

Here's the code for the php file:

<?php
// get posted data into local variables
$EmailFrom = "Customers";
$EmailTo = "-@-.com";
$Subject = Trim(stripslashes($_POST['Subject']));
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$Comments/Questions = Trim(stripslashes($_POST['Comments/Questions']));

// validation
$validationOK=true;
if (Trim($Name)=="") $validationOK=false;
if (!is_numeric($Name)) $validationOK=false;
if (Trim($Email)=="") $validationOK=false;
if (!is_numeric($Email)) $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=formerror.html\">";
exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Comments/Questions: ";
$Body .= $Comments/Questions;
$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.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=formerror.html\">";
}
?>
-----------------------------------------------------------------------------------------
Note that in the form on the .html page, there is this string of code, which has never been a problem in any other site, but maybe this is causing a problem here:

<form method="POST" action="contact.php">


PLEASE HELP!

Thanks and best regards,

Vernon
Vernontnh
 
Posts: 59
Joined: Wed Nov 05, 2008 6:50 am
Location: USA

Return to User Forum

Who is online

Users browsing this forum: No registered users and 71 guests