Click to See Complete Forum and Search --> : really stupid question


zero_hunter
07-21-2003, 01:07 AM
how do I use PHP to create a form,sort of a request form so that people can go to my site and request for some things?

Vasilli
07-21-2003, 01:26 AM
If you give me a little more info i will try to help

If you are just looking for a form processor that send you the info once filled out, that is easy.

Reply with more info

Jick
07-21-2003, 01:33 AM
Try this. Insert this in between your <body> tags:
<form method="post" name="feedback" action="feedback.php">
Name:<br>
<input type="text" class="text" name="Name" maxlength="50" width="30" size="20"><br>
E-mail:<br>
<input type="text" class="text" name="Email" maxlength="50" width="30" size="20"><br>
Comments:<br>
<textarea cols="30" rows="6" class="text" name="Comments"></textarea><br><br>
<input class="submit" type="submit" value="Submit">
</form>
And make a new file called "feedback.php" and make sure its in the same dir as your form:
<?PHP

$subject = "Feedback";
$headers = "From: Form Mailer";
$forward = 1;
$location = "yourfeedbackthankyoupage.html";
$addresses = array("you@yourdomain.com");

$date = date ("l, F jS, Y");
$time = date ("h:i A");

$msg = "This form was submitted on $date at $time.\n\n";

foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}

foreach ($addresses as $email) {
mail($email, $subject, $msg, $headers);
}
if ($forward == 1) {
header ("Location:$location");
}
else {
echo ("Thank you for submitting our form.");
}

?>
Hope that helps you. :D (Credit for this script goes to Pyro!)

pyro
07-21-2003, 07:43 AM
If it is only going to one address, I'd use this version instead: http://forums.webdeveloper.com/showthread.php?s=&threadid=9543#post48748

zero_hunter
07-21-2003, 10:15 PM
thnx a lot,I need one that include the users e-mail address,name,when does he/she want the item requested and the name of the item they want.I also need it to be posted on my site so other users can see. thxn a lot!:p