View Single Post
Old 02-03-2013, 06:50 PM   PM User | #3
mzpresto
New Coder

 
Join Date: Aug 2012
Posts: 45
Thanks: 15
Thanked 0 Times in 0 Posts
mzpresto is an unknown quantity at this point
Hi

Thanks so much for the quick response, I fixed the errors with the div tag and php and re-uploaded, I get the other script saying message succesful, but the email is not coming through to my inbox I checked the webhost and it does support PHP so I really don't know why it's still not working. I am getting other emails to my inbox so it's not that.

I also tried the CSS for the layout and it is VERY close, but for some reason it stacks name and city together and I have an extra box for comments and I can't for the life of me figure out why???

See here:

http://vicarscafebistro.co.uk/website/contact.html

PHP now reads as follows:

Code:
<?php

$EmailFrom = "heypresto@blueyonder.co.uk";
$EmailTo = "heypresto@blueyonder.co.uk";
$Subject = "Nice & Simple Contact Form by CSS-Tricks";
$Name = Trim(stripslashes($_POST['Name'])); 
$City = Trim(stripslashes($_POST['City'])); 
$Phone = Trim(stripslashes($_POST['Phone'])); 
$Email = Trim(stripslashes($_POST['Email'])); 
$Message = Trim(stripslashes($_POST['Message'])); 

// validation
$validationOK=true;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $message;
$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=contactthanks.php\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>

CSS added:

Code:
}
#page-wrap {
	width:290px;
}	
label {
	float:left;
	margin-bottom: 5px;
}
input {
	float:right;
	margin-bottom: 5px;
}
and the html...

Code:
<div id="page-wrap"> 
 
	 
				
		<div id="contact-area"> 
			
			<form method="post" action="contactengine.php"> 
            
				<label for="Name">Name:</label> 
				<input type="text" name="Name" id="Name" />
                
                <label for="City">City:</label> 
				<input type="text" name="City" id="City" />
			
				<label for="Phone">Phone:</label> 
				<input type="text" name="Phone" id="Phone" />
                
				<label for="Email">Email:</label> 
				<input type="text" name="Email" id="Email" />
				
				<label for="Message">Comments:</label>
				<textarea name="Message" rows="5" cols="33" id="Message"></textarea>
 
			<input type="submit" name="submit" value="Submit" class="submit-button" /> 
			</form> 
			
			<div style="clear: both;"></div> 
			
 
		
		</div> 
	
	</div>

Last edited by mzpresto; 02-03-2013 at 06:55 PM.. Reason: add php
mzpresto is offline   Reply With Quote