Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

php send form data as a email

$
0
0
im very new to php i have a form

Name : _______________
Contact Number : ____________________
Comment : _________________________

if the user click submit i want to get all the details via email
so far i wrote this

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?php

	$user_name = $_POST["NameBox"];
	$user_contact = null;
	$user_contact=$_POST["ContactBox"];
	$comment = $_POST["msgbox"];
	
	if($user_contact==null)
	{
		$user_contact = "Not provided";
		
	}
	
	
	$to = "myemail@domain.com";
	 $subject = "Message From Web";
	 $body = "Contact name is = $user_name | Contact number is = $user_contact | user comment is = $comment";
	 
	 mail($to, $subject, $body);
	 
	 header( 'Location:confirmation.html ' ) ;
	 
	
	
	

?>


</body>
</html>


when i submit the form i can't get the e-mail (because i don't have any mail server)
i want to know is there any fault in my code??
another thing is how do i get mail to me without any password
simply i want to know will it work ?
thanks

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>