Link to home
Start Free TrialLog in
Avatar of tru504187211
tru504187211

asked on

Is my logic wrong for this form??

Upon landing on this page, there should be no value for 'send'.  I thought my form should only allow the part that says 'if send=2, then do this', should only appear if the value for send is 2 (which it would only be if the form was not filled out entirely), but it is also appearing if send has no value.

Any ideas??
<?php include ("header_contact.php") ?>	
	
				</td>
    			<td width="550" valign="top">
					<table width="95%" border="0" cellspacing="0" cellpadding="3" class="maintext" align="center">
  						<tr>
    						<td valign="top"> <div id="main" /><h1>Contact</h1><br /><br />
							
							

							<br /><br />All required fields on this page are designated by an <font color="red">*</font>.<br />
						
						<?PHP if ($_GET[send] < 1) { ?>
						<?PHP echo $_GET[send];?>
<?php include "appformdd.php";?>


							</td>
  						</tr>
					</table>

				</td>
    			
  			</tr>
		</table>
	</td>
    <td width="5" bgcolor="#FF5903">
	</td>
	</tr>
</table>
<?php include ("footer.php") ?>


<?PHP } 
if ($_GET[send] == 1) 

include ("securimage/securimage.php");

$securimage = new Securimage();

{
        if ($_POST[NAME] == $nil || $_POST[COMPANY] == $nil || $_POST[PHONE] == $nil || $_POST[EMAIL] == $nil || $securimage->check($_POST['captcha_code']) == false)
$_GET[send] = 2;

}

if ($_GET[send] == 1) {

//$to="info@domain.com";
$to="john@domain.com";
$headers.= "MIME-Version: 1.0\n";
$headers.= "Content-type: text/html; ";
$headers.= "charset=iso-8859-1\n";
$headers.= "From: Contact Form <info@domain.com>\r\n"; 
$subject = "Contact Request - Online Form";

$body = "<HTML><BODY>
<b>Name:</b> $_POST[NAME]<br />
<b>Company:</b> $_POST[COMPANY]<br />
<b>Phone:</b> $_POST[PHONE]<br />
<b>Email:</b> $_POST[EMAIL]<br />
<b>Contact Method:</b> $_POST[CONTACTMETHOD]<br />
<b>Reason for Request:</b> $_POST[COMMENT]<br />

</BODY></HTML>
";

mail($to,$subject,$body,$headers);

?>
<center><h3>&nbsp;Your request has been submitted!</h3><br />
A company representative will contact you as soon as possible. Thank you.<br /><br /></center>


<?PHP } 
if ($_GET[send] == 2) {
?>
<br /><center><font color="red">Please complete all the required fields.  Required fields are marked with an *.</font>
</center>
<BR>
<?php include "appformdd.php"; ?>





							</td>
  						</tr>
					</table>

				</td>
    			
  			</tr>
		</table>
	</td>
    <td width="5" bgcolor="#FF5903">
	</td>
	</tr>
</table>
<?php include ("footer.php"); } ?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial