Contact us form
Moderator: General Moderators
-
webcreator
- Forum Newbie
- Posts: 1
- Joined: Thu Oct 03, 2002 11:10 am
- Location: Perth, Australia
- Contact:
Contact us form
I'm a young developer and I'm having trouble creating a contact form, can some one please help me regarding this matter. I have tried to creat them but not good. I'm able to alter coding but have had no real luck in creating a from page from scratch.

- mydimension
- Moderator
- Posts: 531
- Joined: Tue Apr 23, 2002 6:00 pm
- Location: Lowell, MA USA
- Contact:
Here is a little script that I use as a quick fix for mailing a contact for to someone. Not much built in for formatting, but it gets the job done.
This script is setup to atleast have two fields named "name" and "email". It will accept any other form fields that are posted to the page also.
This script is setup to atleast have two fields named "name" and "email". It will accept any other form fields that are posted to the page also.
Code: Select all
<?php
$mailBody = "";
while (list($key, $value) = each($_POST))
{
$mailBody .= $key . ": " . $value . "\n";
}
if ($_POSTї"name"] != "" || $_POSTї"email"] != "")
{
if ($_POSTї"name"] == "")
{
$name = "No Name Given";
}
if ($_POSTї"email"] == "")
{
$email = "no_email_address@mydomain.com";
}
mail("you@yourdomain.com", "Website Comments", "$mailBody", "From: $name <$email>");
}
?>