Contact us form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
webcreator
Forum Newbie
Posts: 1
Joined: Thu Oct 03, 2002 11:10 am
Location: Perth, Australia
Contact:

Contact us form

Post by webcreator »

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.

:D
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

can you show us what you have so far? someone here may be able to give you a few pointers to getting your code to work :)
User avatar
mr_griff
Forum Commoner
Posts: 64
Joined: Tue Sep 17, 2002 11:11 am
Location: Bozeman, Montana

Post by mr_griff »

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.

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>");
}
?>
Post Reply