Jump to content

ilottl

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by ilottl

  1. Here is a link to the real page which I have had to put default values in for every field.. http://www.cartagesolutions.co.nz/quote.php I have also tried removing the empty part of the script but makes no difference. The form only seems to work if all fields are completed. Help!! Any ideas??
  2. Thanks for that, so if if (!empty($_POST)) { is the problem is there any way to assign a value, eg "Not completed" to the empty $_POST, eg if (!empty($_POST)) THEN $_POST = "N/A" {
  3. I have the simple code below which seems to have worked on forms from a contact page on a website. Unfortunately, it seems to only send the forms if all fields are entered. I have played with the code but cannot seem to get it to send any field that has been completed on submit. Can someone help please? <?php $emailAddress = "bigL@gmail.com"; $thankyouPage = ""; session_start(); if (!empty($_POST)) { foreach ($_POST as $key=>$value) { $_POST[$key] = stripslashes($_POST[$key]); $_POST[$key] = htmlspecialchars($_POST[$key],ENT_QUOTES); } } if (isset($_POST['send']) AND isset($_SESSION['msgCount'])) { if ($_SESSION['msgCount'] >= "3") $alert = "Only 3 messages can be s +ent per session."; if (empty($alert)) { $_SESSION['msgCount']++; putenv('TZ=EST5EDT'); // eastern time $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n" +; $message = "<table cellpadding='5' border='1'>"; foreach ($_POST as $key => $value) if (!preg_match("(^send)",$key)) { $value = wordwrap($value,65,"<br />"); $message .="<tr><td><b>$key</b></td><td>$value</td></tr>"; } $message .= "</table>"; $message .= "<br />Time of the message: ".date(" F d h:ia")."<br +/>"; $message .= "IP Address: ".$_SERVER['REMOTE_ADDR']."<br />"; $message .= "Hostname: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."< +br />"; $subject = $_SERVER['HTTP_HOST']." Message"; mail($emailAddress,$subject,$message,$headers); if (!empty($thankyouPage)) { header('location: '.$thankyouPage); die(); } unset($_POST); $alert = "Your enquiry has been sent, we will respond as soon as p +ossible."; } } if (!isset($_SESSION['msgCount'])) $_SESSION['msgCount'] = 0; ?>
×
×
  • 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.