pixeltrace Posted October 17, 2007 Share Posted October 17, 2007 hi, i need help, i got an inquiry page and i am having a problem on my if condition on line 203 Notice: Undefined index: Submit in /var/www/html/ILEC/contact.php on line 203 below is my current code <? if (isset($_POST['Submit'])) { $salutation = $_POST['salutation']; $name = $_POST['name'] ; $email = $_POST['email'] ; $phone = $_POST['phone'] ; $organization = $_POST['organization'] ; $designation = $_POST['designation'] ; $message = $_POST['message'] ; $msg = "A General Enquiry was sent from testwebsite \n" ."Name: ".$name."\n" ."Email Address: ".$email."\n" ."Contact No: ".$phone."\n" ."Organization: ".$organization."\n" ."Designation: ".$designation."\n" ."Enquiry: ".$message; //mail the above data // to send HTML mail, the Content-type header must be set $to ='[email protected]'; $subject = 'test - General Enquiry'; $message = $msg; $headers = 'From: ' .$email. "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); $cr = "\n"; $date=date('Y-M-d G:i:s'); //write data to csv $data = $name . ',' . $email . ',' . $phone . ',' . $organization . ',' . $designation . ',' . $message . ',' . $date . $cr; $filename = 'logs/enquirylog.csv'; $fp = fopen($filename,"a"); // $fp is now the file pointer to file $filename if($fp){ fwrite($fp,$data); // Write information to the file fclose($fp); // Close the file } } ?> <html> <head> <?php include("model/class/DBConn.php"); include("model/class/SEO.php"); include("model/SEOManager.php"); $seoManager = new SEOManager(); $seo = $seoManager->get(5); ?> <title><?php echo $seo->title; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Keywords" content="<?php echo $seo->keywords; ?>"> <meta name="Description" content="<?php echo $seo->description; ?>"> <link href="includes/style.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <!-- scripts for the sidebar start--> <link href="includes/js/base.css" rel="stylesheet" type="text/css"> <link href="includes/js/index.css" rel="stylesheet" type="text/css"> <script src="includes/js/prototype.js" type="text/javascript" charset="utf-8"></script> <script src="includes/js/scriptaculous.js" type="text/javascript" charset="utf-8"></script> <script src="includes/js/browserdetect.js" type="text/javascript" charset="utf-8"></script> <script src="includes/js/drawers.js" type="text/javascript" charset="utf-8"></script> <!-- scripts for the sidebar end --> <script src="includes/js/tabs.js" type="text/javascript" charset="utf-8"></script> <style type="text/css"> <!-- .style1 {color: #FFFFFF} --> </style> </head> <body class="iphone" id="index"> <table width="882" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="16" align="left" background="images/leftbg.gif"><img src="images/leftbg.gif" width="16" height="5"></td> <td width="850"><table width="850" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="850"> <!-- header table start--> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="412" rowspan="3" valign="top"><img src="images/logo.gif" width="403" height="114"></td> <td width="438"></td> </tr> <tr> <td><!-- top navi start--> <? include ('includes/topnav.php'); ?> <script>change5();</script> <!-- top navi end --></td> </tr> <tr> <td align="right" valign="bottom"><!-- search bar start --> <? include ('includes/searchbar.php'); ?> <!-- search bar end --> </td> </tr> <tr> <td colspan="2"> </td> </tr> </table> <!-- header table end--> </td> </tr> <tr> <td><table width="850" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="205" valign="top" style="padding-left:15px"><?php include("includes/sidebar.php"); ?> <!-- welcome start --> <!-- welcome end --></td> <td width="645" rowspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#003466" height="8"><img src="images/blank.png" width="1" height="8"></td> </tr> <tr> <td style="padding-bottom:20px; padding-top:10px "><span class="title2">Contact Us</span></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2" class="title3" style="padding-bottom:10px "> CapitaLand ILEC Pte. Ltd.<br> A Member of CapitaLand<br> 8 Shenton Way #49-01 <br> Singapore 068811 </td> </tr> <tr> <td width="10%" class="text1"><b>Tel no. </b></td> <td width="90%"> <span class="title3"> (65) 6622 6000</span> </td> </tr> <tr> <td class="text1"><b>Fax no. </b></td> <td width="90%" class="title3"> (65) 6822 6038 </td> </tr> <tr> <td class="text1"><b>Reg no. </b></td> <td width="90%" class="title3"> 199701358Z </td> </tr> </table> </td> </tr> <tr> <td> </td> </tr> <tr> <td><hr class="e"></td> </tr> <tr> <td><span class="title">General Inquiry</span> <span class="text1">(</span><span class="text4"><b> *</b></span><span class="text1"> compulsory fields) </span></td> </tr> <tr> <td> </td> </tr> <tr> <td><!-- script for the form validation start--> <script language="Javascript"> function validate(f) { var email = f.email.value; var r = new RegExp("^[\\w\\.\\-]+@\\w+[\\w\\.\\-]*?\\.\\w{1,4}$"); // do field validation if (f.name.value == "") { alert( "Please enter your Name." ); return false; } else if (f.email.value == "") { alert( "Please enter your Email Address." ); return false; } else if (f.message.value == "") { alert( "Please enter your Message." ); return false; } else form.submit(); } </script> <!-- script for the form validation end --> <? if ($_POST['Submit'] == ''){ ?> <!-- enquiry form code start --> <form method="post" action="" name="form1" onSubmit="return validate(this);"> <table width="630" border="0" align="center" cellpadding="0" cellspacing="3"> <tr> <td width="144" align="right" class="text3"><b>Salutation : </b></td> <td width="477"><select name="salutation" class="field1"> <option value="Mr.">Mr.</option> <option value="Ms.">Ms.</option> <option value="Mrs.">Mrs.</option> </select> </td> </tr> <tr> <td align="right" class="text3"><b><span class="text4">*</span>Name : </b><span class="text4"> </span></td> <td><input name="name" type="text" class="field1" size="40"> </td> </tr> <tr> <td align="right" class="text3"><b><span class="text4">*</span>Email Address : </b> <span class="text4"> </span></td> <td><input name="email" type="text" class="field1" size="40"> </td> </tr> <tr> <td align="right" class="text3"><b>Contact Number : </b></td> <td><input name="phone" type="text" class="field1" size="40"></td> </tr> <tr> <td align="right" class="text3"><b>Organization : </b></td> <td><input name="organization" type="text" class="field1" size="40"></td> </tr> <tr> <td align="right" class="text3"><b>Designation : </b></td> <td><input name="designation" type="text" class="field1" size="40"></td> </tr> <tr> <td align="right" valign="top" class="text3"><b><span class="text4">*</span>Message : </b><span class="text4"> </span></td> <td><textarea name="message" cols="45" rows="5" class="field2"></textarea> </td> </tr> <tr> <td> </td> <td><input name="Submit" type="submit" class="button1" value="Submit"></td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </form> <!-- enquiry form code end --> <? }else{ ?> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td> </td> </tr> <tr> <td align="center"><font class="title" style="font-size:18px; line-height:22px">Thank you for your enquiry.<br> We will contact you shortly.</font></td> </tr> </table> <? } ?> </td> </tr> </table> </td> </tr> </table></td> </tr> <tr> <td><!-- footer table start --> <?php include('includes/footer.php'); ?> <!-- footer table end --> </td> </tr> </table></td> <td width="16" align="right" background="images/rightbg.gif"><img src="images/rightbg.gif" width="16" height="5"></td> </tr> </table> </body> </html> hope you could help me with this. thanks! Link to comment https://forums.phpfreaks.com/topic/73605-solved-need-help-in-my-form-mail/ Share on other sites More sharing options...
darkfreaks Posted October 17, 2007 Share Posted October 17, 2007 <?php if ($_POST['Submit']==""){ ?> or <?php if (empty($_POST['Submit'])){ ?> Link to comment https://forums.phpfreaks.com/topic/73605-solved-need-help-in-my-form-mail/#findComment-371372 Share on other sites More sharing options...
pixeltrace Posted October 17, 2007 Author Share Posted October 17, 2007 thanks! it worked! Link to comment https://forums.phpfreaks.com/topic/73605-solved-need-help-in-my-form-mail/#findComment-371383 Share on other sites More sharing options...
darkfreaks Posted October 17, 2007 Share Posted October 17, 2007 your welcome Link to comment https://forums.phpfreaks.com/topic/73605-solved-need-help-in-my-form-mail/#findComment-371479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.