Jump to content


This topic is now archived and is closed to further replies.


PHP Contact Form ???

Recommended Posts

After virtually, bending over backwards, I managed to FINALLY got the SMTP e-mail making it possible to actually receive the data entered by viewers in my Contact form.

Its code (in .txt) can be seen from:


Actual page can be viewed on:


Sadly, however, I was only receiving the "message" itself & NOT the "title", "first_name", "last_name", "contact_no.", etc.

I realised that I didn't include other field WITHIN php's "mail" function & hence wasn't gettting this on my e-mail (after user submits the form).

I've now added "additional parameters" (if I'm right), so as to receive all the required fields. Firstly, I'm unsure if what I've added is right or wrong & secondly, I'm getting some "syntax" error.

So, the 1st version of this PHP "mail" code was:

[code=php:0](mail("contact@allinclusivewebdesign.byethost13.com", $_POST['inquiry'], stripslashes($_POST['message']), "From: " . $_POST['email']))[/code]

The revised version i.e. the one where I've added "additional parameters", so as to receive ALL fields in my e-mail:

("From: " . $_POST['email']),
("Inquiry: " . $_POST['inquiry']),
("Title: " . $_POST['title']),
("First Name: " . $_POST['first_name']),
("Last Name: " . $_POST['last_name']),
("E-mail: " . $_POST['email']),
("Phone: " . $_POST['phone']),
("Message: " . $_POST['message']),
("Reply: " . $_POST['reply']),
("Contact: " . $_POST['contact']))

I wonder, hence, if anyone around could possily check my "updated" code, which is:


I simply wish to receive ALL the fields data on my e-mail.

Share this post

Link to post
Share on other sites
Did you look at the reference manual's description for the mail() function? http://www.php.net/manual/en/function.mail.php

Where in that description does it mention you can have more than 5 parameters?

You need to put that information into the $body:
$body = "Inquiry: " . $_POST['inquiry'] . "\n";
$body .= "Title: " . $_POST['title'] . "\n";
$body .= "First Name: " . $_POST['first_name'] . "\n";
$body .= "Last Name: " . $_POST['last_name'] . "\n";
$body .= "E-mail: " . $_POST['email'] . "\n";
$body .= "Phone: " . $_POST['phone'] . "\n";
$body .= "Message: " . $_POST['message'] . "\n";
$body .= "Reply: " . $_POST['reply']) . "\n";
$body .= "Contact: " . $_POST['contact'] . "\n";

mail("contact@allinclusivewebdesign.byethost13.com", $_POST['inquiry'], $body, "From: " . $_POST['email']);


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.