I have a feedback form code which does email but does not display the correct content.
In place of the email address, it displays "+1"
And the body message is "1"
It works well when I test it on localhost.
As in
FROM: +1
MESSAGE:+1
What is missing in my code, some body help
My code
In place of the email address, it displays "+1"
And the body message is "1"
It works well when I test it on localhost.
As in
FROM: +1
MESSAGE:+1
What is missing in my code, some body help
My code
Code:
<?php
require_once 'functions.php';
require_once'template.php';
Head('Make an Order/enquiry');
?>
<div id="pgcontent">
<h3><em>Place your Order/Enquiry</em></h3>
<?php
// Change to your own email address
$your_email = "sunny@lavis-casual.com";
// This is what is displayed in the email subject line
$subject = "LAVIS-CASUAL email order/enquiry";
// This is displayed if all the fields are not filled in
$empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>";
// This is displayed when the email has been sent
$thankyou_message = "<p>Thankyou. Your message has been sent. We will be contacting you shortly.</p>";
$name = "";
$email = "";
$message = "";
//Email variables
$name = stripslashes(isset($_POST['txtName']));
$email = stripslashes(isset($_POST['txtEmail']));
$message = stripslashes(isset($_POST['txtMessage']));
if (!isset($_POST['txtName'])) {
?>
<form name="frmOrder" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<p>
<label>Full Name:</label>
<br>
<input type="text" title="Enter your name" name="txtName" size="50"></p>
<p>
<label>Email address:</label>
<br>
<input name="txtEmail" type="text" title="Enter your email address" value="" size="50">
</p>
<p><label>Your message:</label><br>
<textarea name="txtMessage" cols="50" rows="5" title="Enter your message"></textarea>
</p>
<p><label title="Send your message">
<input type="submit" value="Send" onClick="return checkOrder();"></label>
<input name="Reset" type="reset" value="Clear form">
</p>
</form>
<?php
}
else {
// Stop the form being used from an external URL
// Get the referring URL
$referer = $_SERVER['HTTP_REFERER'];
// Get the URL of this page
$this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"];
// If the referring URL and the URL of this page don't match then
// display a message and don't send the email.
if ($referer != $this_url) {
echo "You do not have permission to access this form from another URL.";
exit;
}
// The URLs matched so send the email
mail($your_email, $subject, $message, "From: $name <$email>");
// Display the thankyou message
echo $thankyou_message;
}
?>
<script>
function checkOrder()
{
with (window.document.frmOrder)
{
if (txtName.value.length < 3)
{
alert('Enter Your full name!');
txtName.focus();
return false;
}
else if (txtEmail.value.length < 1 || txtEmail.value.indexOf("@", 0) == -1)
{
alert ("Please enter a valid email address!");
txtEmail.focus();
return false;
}
else if (txtMessage.value == "")
{
alert('Enter your order/enquiry details!');
txtMessage.focus();
return false;
}
else
{
return true;
}
}
}
</script>
</div>
<?php
Footer();
?>