Html form passing to php

Soldato
Joined
18 Oct 2002
Posts
9,223
I have spent a couple of hours wading through tutorials trying to find out how to do the following, they all seem to be far too complicated and there seems to be a million and one ways to do it:

I have 3 fields, FirstName, Surname, and Email. When the user hits submit, the data within the textboxes are passed to php, which in turn sends to my email ([email protected] for instance) with the subject "User Details". The user is then directed to "http://www.domain.com/thankyou.php"

Once this has been sent, I want to recieve an email at the above domain nicely formatted (must be in the correct order):

FirstName: Fred
Surname: Brown
Email: [email protected]

Code:
<?
	$recipient = '[email protected]' ;
	$subject = 'User Details' ;

	
	
	$FirstName = $_REQUEST['FirstName] ;
	$Surname = $_REQUEST['Surname'] ;
	$Email = $_REQUEST['Email'] ;
	


mail( "$recipient","$subject",
	"\n First Name: \n $FirstName",
	"\n Surname: \n $Surname",
	"\n Email:\n $Email", ;
	

header( "Location: http://www.domain.com/thankyou.php" );
?>

Why won't this work? :confused:
 
Thanks for the advice guys, the above was a basic explanation just to get it working (which it did :)), however, I now have more than 5 data items and get the following error:

Warning: mail() expects at most 5 parameters, 19 given in /path/ on line 41

So how do I get around this? :confused:

Edit: Found a really good example here: http://forums.digitalpoint.com/showthread.php?t=2849
 
Last edited:
Having not used PHP much prefer I have found it quite difficult to even do the simplest of things. This is just being used as an example, I don't need to enter validation etc as its a bit OTT.

Thanks anyway, all sorted now. Works flawlessly!
 
Back
Top Bottom