nagger Posted September 27, 2007 Share Posted September 27, 2007 Guys, Just trying to get into PHP but I am struggling with the following: When setting up a php mail form I can get all working. My problem is that I can't get the form to send both the fillers name and email and display it in the body of the received email. In the HTML age I have <form action="process.php" method="post"> Name: <input type="text" name="name" size="20" maxlength="20" /><br /> Email: <input type="text" name="email" size="30" maxlength="30" /><br /> <input type="hidden" name="sub" value="XXXXX" /><br /> <input type="submit" name="submit" value="Send" /> </form> And in the php page I have Thanks <?php @extract($_POST); $name = stripslashes($name); $email = stripslashes($email); mail('info@mydomain.com',$sub,$email,"From: $name <$email>"); echo $_POST["name"]; ?> , We will drop you a line shortly. Any thoughts? Quote Link to comment Share on other sites More sharing options...
apulmca2k4 Posted October 17, 2008 Share Posted October 17, 2008 Yes, I can do it. contact on apulmca2k4@gmail.com Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 17, 2008 Share Posted October 17, 2008 This forum is for help for everyone's benefit. If you have a solution post it here. Ken Quote Link to comment Share on other sites More sharing options...
o3d Posted October 17, 2008 Share Posted October 17, 2008 you can try this: <?PHP if (isset($_POST['submit'])) { $name = ""; $email = ""; if (isset($_POST['name'])) $name = $_POST['name']; if (isset($_POST['email'])) $email = $_POST['email']; $Body .= "Name: $name\n"; $Body .= "Email: $email\n"; if (mail('email@domain.co.za','Mail from website',$Body,"From: $email")) echo 'mail has been sent<br>'; else echo 'mail could not be sent<br>'; } ?> <form method="POST"> Name: <input type="text" name="name" size="20" maxlength="20" /><br /> Email: <input type="text" name="email" size="30" maxlength="30" /><br /> <input type="submit" name="submit" value="Send" /> </form> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.