...

View Full Version : PHP Mailing a Form



Nexusfactor
12-07-2010, 04:41 AM
Please forgive me, I new to PHP, however I have a question. I created a webpage that has some html and java script validation to make sure the user does not forget to enter some data. However afterward, I would like to e-mail the form to a specific e-mail account, could someone be able to edit the code to implement the required function?
If anyone could implement this into my page: http://www.thesitewizard.com/archive/feedbackphp.shtml

http://studentweb.cencol.ca/nsingh76/superAssignment4.html

Plenty of thanks in advanced.

mlseim
12-07-2010, 05:05 AM
Change this:

<form action="MAILTO:whatisthematrix01@hotmail.com?subject=Survey Results" name="frmCustomer" method="post">

To this:

<form action="cont.php" name="frmCustomer" method="post">


Then copy/paste this script as "cont.php" and upload it to the same directory.


<?php

// This is a super basic mail form without any
// validation, captcha, or checking of any kind.

// Get variables from your form ...
$firstname = $_POST['Fname'];
$lastname = $_POST['Lname'];
$usercity = $_POST['UseCity'];
$usercountry = $_POST['UserCountry'];
$useremail = $_POST['userEmail'];
$username = $_POST['Username'];
$userpassword = $_POST['Userpassword'];
$radgender = $_POST['radGender'];

// Who the form gets sent to ...
$recipient = "whatisthematrix01@hotmail.com";
$subject = "Interstellar Shipping Contact Form";

// Where to go after the user submits the form ...
$redirect = "index.html";

$message = "
================================
Name: $firstname $lastname
User: $username
Email: $useremail
-----------------------------------------
City: $usercity
Country: $usercountry
Password: $userpassword
RadGender: $radgender
================================
";

$extraheaders = "From: $useremail\n\nReply-To: $useremail\n\n";

if (! mail($recipient, $subject, $message, $extraheaders))
echo "Mail did not send for some reason.";

header("Location: ".$redirect);

?>

Nexusfactor
12-07-2010, 05:21 AM
I DON'T KNOW HOW TO THANK YOU!!!!!
MANY THANKS SERIOUSLY

:)


I THANK YOU AGAIN AND AGAIN AND AGAIN in C#

//infinite loop
while (true)
{

Console.WriteLine ("Thank You");

}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum