PDA

View Full Version : Another line or a new mailing.php ?


perfectgreeneye
08-26-2005, 09:18 AM
hi everybody.
i need some help here please. i always design first my forms in frontpage and after i bind them to my php file. now in this case i have designed two forms. a simple one with 3 boxes:
NAME
EMAIL
SUGGESTION
i have wrote the mailing.php for it like this:
-----------------
<?php

// your email address
$youremail = "adminatbicestertown.co.uk";
// field validation
if ($email=="" || $comments=="" || $name=="")
{
print ("All fields are required! Please go back and try again.");
}
else {
// email validation
if(!eregi('^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3})?)$', $email)) {
print ("Your email address does not appear to be valid. Please go back and try again.");
exit;
}
// send email
$headers = "From: \"$name\" <$email>\n";
$subject = "Feedback Form";
$message = "$comments";
mail ("$youremail", "$subject", $message, $headers);
print ("Thank you $name, your email has been sent to Bicester Town.");
}
?>
---------------------

The second form it's same like above form but contains a few more fields(boxes)

BUSINESS NAME
CONTACT PERSON
PHONE
EMAIL
WEB
DETAILS

i have not made the php yet for this one as i have a few questions before.

1) Can i use the above php code for the same job? if yes, what do i have to do? To add a few more fields? Or i have to design a new php file with a different name?

thank you very much for your time and understanding. :boogy:

01482
08-26-2005, 10:07 AM
You could have a generic form manager that handles all your forms. You would need to extract all your field names as not every form will be the same.

At work we have a form manager that does this but we have about 200 forms on the site. In your case I would probably make another processing page for it.

perfectgreeneye
09-02-2005, 07:26 PM
Thanks a lot 01482. It's is sorted now.