PHPMine
<? if(PHP > $Expectations) echo $Results ?>
by Angel S. Moreno
UNDER SOME SERIOUS CONSTRUCTION LINKS MAY NOT WORK
Asked 2010-03-03 13:13:43 by TommyC
i built a website that has an enquiries form on it, and when you click submit, it sends the form, but it comes through with the "Name" field in thesubject of the email, and only shows the "Email" field in the data. it doesnt display the "phone" or "message" data.
here is the code i'm using (obviously the my domain bits have the email data in it but as it's not my email data to give out i had to hide it):
<?php
ini_set ("SMTP","smtp.mydomain.co.uk");
ini_set ("sendmail_from","webmaster@mydomain.co.uk");
if (isset($_REQUEST['name']))
{
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$message = $_REQUEST['message'];
mail("me@mydomain.co.uk", "Name:$name", "Email:$email", "Phone:$phone", "Message:$message");
echo "<center><p><br /><br />Thanks for your question.<br /> We will get back to you as soon as possible.</center>";
}
else
{
echo "<form method='post' action='enquiries.php'>
Name: <input name='name' type='text' /><br />
Email: <input name='email' type='text' /><br />
Phone: <input name='phone' type='text' /><br />
Message: <br />
<textarea name='message' rows='10' cols='40'></textarea><br />
<input type='submit' />
</form>";
}
?>
any ideas as to why when i open the email it only shows the "Email" data and not "phone" and "message"?
Anwered 2010-03-03 13:35:22 by mata
hav a look at the definition of the mail function:
http://at.php.net/manual/en/function.mail.php
first parameter is address, second the subject, and third the message.
so you have to concatenate your message to a single string to send it all within the body
Anwered 2010-03-03 13:38:35 by Nisovin
The mail() function accepts four parameters: to, subject, message, and headers. This means that all those fields need to go into the SAME parameter, not separate ones.
mail("me@mydomain","Subject","Name:$name; Email:$email; Phone: $phone; Message:$message");
You can add line breaks with <br> if you have HTML enabled. You might also be able to use \n, I'm not sure.
Anwered 2010-03-03 17:52:57 by Ron
Try letting this site remake the form for you:
http://www.thesitewizard.com/wizards/feedbackform.shtml
Others...
http://www.phpform.org/
http://www.tele-pro.co.uk/scripts/contact_form/
http://www.jotform.com/?gclid=CNKhqei1wJ4CFRQhnAod6laUqA (WYSIWYG Form Maker)
http://emailmeform.com/
http://www.freecontactform.com/
http://www.reconn.us/content/view/12/34/ (Download - Contact Us Script)
http://formsmarts.com/
http://apptools.com/phptools/forms/forms1.php
Ron
Questions and answers provided by the Yahoo Answers Community.