Page 1 of 1

Need help to create a simple php form

Posted: 08 Sep 2008, 16:48
by CesarePlay
Hi everyone. I need some help. I need to create a simple php script for a feedback form. The form contains subject, name, email and comments.

I have tried google but not finding the script I used before and I can't find my script. Can anyone help with this?

Re: Need help to create a simple php form

Posted: 08 Sep 2008, 17:27
by RevQ
What is it you want the form to do? Go into a database or fire an email off?

Re: Need help to create a simple php form

Posted: 08 Sep 2008, 17:35
by CesarePlay
To fire an email off. I got it started but I have no idea how the rest of the script must look like. Here is what I got so far:

?php

$Subject = $_POST[‘subject’] ;
$Name = $_POST[‘name’] ;
$Email = $_POST[‘email] ;
$Comment = $_POST[‘comments’] ;

Re: Need help to create a simple php form

Posted: 08 Sep 2008, 18:17
by RevQ

Code: Select all

<?php
$Subject = $_POST[‘subject’] ;
$Name = $_POST[‘name’] ;
$Email = $_POST[‘email] ;
$Comment = $_POST[‘comments’] ;

$headers = "From: ".$Name." <".$Email.">\r\n";
$headers.= "Reply-To: ".$Email."\r\n";
mail("abc@123.co.za",$Subject, $Comment,$headers);
?>
Simply change the abc@123.co.za to the address you want it to send to and that should be good :D

Re: Need help to create a simple php form

Posted: 08 Sep 2008, 18:19
by CesarePlay
RevQ wrote:

Code: Select all

<?php
$Subject = $_POST[‘subject’] ;
$Name = $_POST[‘name’] ;
$Email = $_POST[‘email] ;
$Comment = $_POST[‘comments’] ;

$headers = "From: ".$Name." <".$Email.">\r\n";
$headers.= "Reply-To: ".$Email."\r\n";
mail("abc@123.co.za",$Subject, $Comment,$headers);
?>
Simply change the abc@123.co.za to the address you want it to send to and that should be good :D
Ok. Thanks.