Jump to content

[SOLVED] Not seen this before


jaic

Recommended Posts

<?php

if(isset($_POST['Submit'])) {

$name = $_POST['name'];

$tele = $_POST['tele'];

$email = $_POST['email'];

$comments = $_POST['comments'];

$mailing = $_POST['mailing'];

if($name == '' or $email == '' or $comments == '') {

$err = true;

$msg = 'Please complete all the required fields for us to be able to contact you.';

} else {

$mailmsg = 'OceanSafe WEBSITE MAIL:' . "\n\n";

$mailmsg.= 'Name: ' . $name . "\n";

$mailmsg.= 'Tele: ' . $tele . "\n";

$mailmsg.= 'Email: ' . $email . "\n";

$mailmsg.= 'Required: ' . $required . "\n";

if($mailing == 'true') {

$mailmsg.= 'Please add me to your mailing list to receive notice of offers from time to time';

}

if (eregi("\r",$email) || eregi("\n",$email)){

die ("spam!");

 

} else {

if(mail([email protected],'OceanSafe - Web Enquiry Form', $mailmsg, "From: [email protected]")) {

header("Location: validate.htm");

}

}

}

}

?>

 


and in th form


 

<form id="form2" method="post" action="contact.php">

  <div>

    <p align="center">

    <font size="2" face="Verdana">

    <label for="name">Full Name:*</label><br>

    <input name="name" type="text" class="text" id="name" value="<?php echo $name; ?>" size="45" /><br>

<label for="name">Daytime Contact Number:*</label><br>

    <input name="tele" type="text" class="text" id="tele" value="<?php echo $tele; ?>" size="45" /><br>

<label for="email">Your Email Address:*</label><br>

<input name="email" type="text" class="text" id="email" value="<?php echo $email; ?>" size="45" /><br>

<label for="comments">Work Required :*</label><br>

<textarea name="comments" cols="34" rows="2" class="text" id="comments"><?php echo $comments; ?></textarea><br>

<label for="mailing">Add me to your mailing list</label>

    <input type="checkbox" name="mailing" value="true" id="mailing" /><br>

<input name="Submit" type="submit" class="btn" value="SEND" />

</font>

</div>

</form>

 

I *think* you have error handling on either in your script or turned on for the server by default. Since the page has not been POSTed, the variables do not have a value and it is throwing the error. Try ensuring that the variables have been set first:

 

<?php

<?php

$name='';
$tele='';
$email='';
$comments='';
$mailing='';

if(isset($_POST['Submit'])) {
   $name = $_POST['name'];
   $tele = $_POST['tele'];
   $email = $_POST['email'];
   $comments = $_POST['comments'];
   $mailing = $_POST['mailing'];
   if($name == '' or $email == '' or $comments == '') {
      $err = true;
      $msg = 'Please complete all the required fields for us to be able to contact you.';
   } else {
      $mailmsg = 'OceanSafe WEBSITE MAIL:' . "\n\n";
      $mailmsg.= 'Name: ' . $name . "\n";
      $mailmsg.= 'Tele: ' . $tele . "\n";
      $mailmsg.= 'Email: ' . $email . "\n";
      $mailmsg.= 'Required: ' . $required . "\n";
      if($mailing == 'true') {
         $mailmsg.= 'Please add me to your mailing list to receive notice of offers from time to time';
      }
      if (eregi("\r",$email) || eregi("\n",$email)){
         die ("spam!");

      } else {
         if(mail([email protected],'OceanSafe - Web Enquiry Form', $mailmsg, "From: [email protected]")) {
            header("Location: validate.htm");
         }
      }
   }
}
?>

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.