PPRuNe Forums - View Single Post - PHP query
Thread: PHP query
View Single Post
Old 28th October 2010 | 23:05
  #2 (permalink)  
tailstrikecharles
 
Joined: Oct 2009
Posts: 63
Likes: 0
From: Greece
I am not quite sure what you are trying to say...

So.. I'll take a guess, and answer that

You have a php form. Lets say that you have something you rent, they go online, fill out the form, and when they click submit, you then get an email with their information and request


Name [________]
Email [_________]
Phone [_______]

Booking Request
[___________________________]
[____________________________]
[____________________________]
^That is how the form would probably look


The HTML of the form would have..
Code:
<html>
<head>
</head>
<body>
<form target="mailer.php" action="post">
....etc..
</form>
</body>
</html>

Mailer PHP will be basically your form letter

Generally, what is best to do is have the actual letter (that gets the text replaced) as a separate file altogether, and included at run-time, but for this explanation we have it all in one.

Note that this simple explanation does not have the added protections you need to have (to prevent spamming, hacking and assholes)
Code:
<?php
// note.. the fields in the form will show up here as variables in the $_POST object as follows
$name = $_POST['name']; //etc etc

//email template
$headers = "From:". $_POST['email']."\r\n"
$subject="Booking request";
$to ="[email protected]";
$body = $_POST['request'];
 if (@mail($to, $subject, $body, $headers)) {
 echo("<p>Message sent!</p><pre>" .$body. '</pre>');
		} else {
 echo("<p>Message delivery failed...</p>");
		}
tailstrikecharles is offline  
Reply