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:
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
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
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: