Jump to content


Photo

PHP Contact Form ???


  • Please log in to reply
1 reply to this topic

#1 j4mes_bond25

j4mes_bond25
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 06 July 2006 - 07:05 PM

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:

http://members.lycos...contact.php.txt

Actual page can be viewed on:

http://members.lycos...ign/contact.php

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:

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


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

(mail("contact@allinclusivewebdesign.byethost13.com", 
	$_POST['inquiry'], 
	stripslashes($_POST['message']), 
("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:

http://members.lycos...updated.php.txt

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

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 06 July 2006 - 07:28 PM

Did you look at the reference manual's description for the mail() function? http://www.php.net/m...nction.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:
<?php
$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']);
?>

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users