RAH Posted July 18, 2008 Share Posted July 18, 2008 Hello, For some reason the following form gives this error even when the checkbox is ticked. "Missing required field : I Accept all the Terms and Conditions" <?php include_once( "20080718-3c1f6feb98bad1e3ffbb0105e41e6bbf.lib.php" ); ?> <html> <head> <title>Contact</title> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1"> <meta name="keywords" content="free forms php form maker"> <meta name="description" content="build php forms with unlimited fields automatic validation, file attachments and auto-responder."> <style type='text/css'> .form_title{ color : #000000; font-size: 13px; font-family: verdana, Geneva, Arial, Helvetica, sans-serif; font-weight : bold; } .form_field { font-size : 13px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #474747; font-weight : bold; text-align:left; } .form_text{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; } .text_box{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; width:200px; } .text_area{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; width:200px; height:60px; } .text_select{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; } .form_error{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #ff0000; font-weight : bold; } .copyright{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; } </style> </head> <body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0"> <center> <meta http-equiv="content-type" content="text/html; charset="> <!-- Begin: Form Description --> <br><br><br> <table cellspacing='16' cellpadding='0' border='0' align='center' ><tr><td> <font class='form_title'></font> </td></tr></table> <!-- End: Your FormMail's Description --> <!-- Begin: Form --> <?php if( !$isHideForm ): global $sErr ; if( $sErr ) print "<br><a name='error'></a><center><font class='form_error' >$sErr</font></center><br>"; $starColor = $sErr ? "#ff0000" : "#000000"; $style=" class='form_text' "; ?> <form name="frmFormMail" action="<?php print PHP_SELF ?>" method='post' enctype='multipart/form-data'> <input type='hidden' name='formmail_submit' value='Y'> <input type='hidden' name='esh_formmail_subject' value="Contact Form Submission"> <input type='hidden' name='esh_formmail_return_subject' value=""> <input type='hidden' name='esh_formmail_return_msg' value=""> <table cellspacing='16' cellpadding='0' border='0' > <tr> <td class="form_field" valign='top' align='right'>Business Name </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Business_Name" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Business_Name" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Contact Name </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Contact_Name" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Contact_Name" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Address Line 1 </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Address_Line_1" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Address_Line_1" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Address Line 2 </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Address_Line_2" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Address_Line_2" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>City </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="City" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "City" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>State </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="State" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "State" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Zip Code </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Zip_Code" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Zip_Code" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Country </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Country" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Country" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Phone Number </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Phone_Number" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Phone_Number" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Fax Number </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Fax_Number" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Fax_Number" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Internet URL or AOL Keyword </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Internet_URL_or_AOL_Keyword" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Internet_URL_or_AOL_Keyword" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Email </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="email" name="Email" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Email" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Current or Projected monthly bankcard $ volume </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Current_or_Projected_monthly_bankcard_$_volume" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Current_or_Projected_monthly_bankcard_$_volume" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Current or Projected AVERAGE ticket/sale amount </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Current_or_Projected_AVERAGE_ticket_sale_amount" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Current_or_Projected_AVERAGE_ticket_sale_amount" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Initials </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Initials" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Initials" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>I Accept all the Terms and Conditions </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="checkbox" name="Checkbox01_I_Accept_all_the_Terms_and_Conditions" value="" ?> > <br> </td> </tr> <tr><td colspan=3 align='center'><input type='submit' value='Submit'> <input type='button' value='Cancel' onclick="location.href='/';"></td></tr> </table> </form> <!-- End: --> <?php if( $sErr ) print "<script language='javascript' type='text/javascript'>location.href='#error';</script>";;; else: //!$isHideForm print( "<br><br><hr><center><b>Your form has been sent. Thank you.</b><br><br><input type='button' value='Home' onclick=\"location.href='/';\"></center><br><br>" ); endif; //!$isHideForm ?> <!-- footer --> <br /><br /> <div class='form_copyr'> </div> <p> </p> </center> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-2637029-29"; urchinTracker(); </script> </body> </html> Any ideas? Thanks. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted July 18, 2008 Share Posted July 18, 2008 should you be using http_post_vars? shouldn't it be $_POST['']; Quote Link to comment Share on other sites More sharing options...
RAH Posted July 18, 2008 Author Share Posted July 18, 2008 should you be using http_post_vars? shouldn't it be $_POST['']; I have no idea. The form was created by an online form generator. Please advise. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted July 18, 2008 Share Posted July 18, 2008 ok, well try changing them. $_POST['']; Quote Link to comment Share on other sites More sharing options...
RAH Posted July 18, 2008 Author Share Posted July 18, 2008 Done, hasn't made any difference. <?php include_once( "20080718-3c1f6feb98bad1e3ffbb0105e41e6bbf.lib.php" ); ?> <html> <head> <title>Contact</title> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1"> <meta name="keywords" content="free forms php form maker"> <meta name="description" content="build php forms with unlimited fields automatic validation, file attachments and auto-responder."> <style type='text/css'> .form_title{ color : #000000; font-size: 13px; font-family: verdana, Geneva, Arial, Helvetica, sans-serif; font-weight : bold; } .form_field { font-size : 13px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #474747; font-weight : bold; text-align:left; } .form_text{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; } .text_box{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; width:200px; } .text_area{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; width:200px; height:60px; } .text_select{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; } .form_error{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #ff0000; font-weight : bold; } .copyright{ font-size : 11px; font-family : Verdana, Arial, Helvetica, sans-serif; color : #000000; } </style> </head> <body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0"> <center> <meta http-equiv="content-type" content="text/html; charset="> <!-- Begin: Form Description --> <br><br><br> <table cellspacing='16' cellpadding='0' border='0' align='center' ><tr><td> <font class='form_title'></font> </td></tr></table> <!-- End: Your FormMail's Description --> <!-- Begin: Form --> <?php if( !$isHideForm ): global $sErr ; if( $sErr ) print "<br><a name='error'></a><center><font class='form_error' >$sErr</font></center><br>"; $starColor = $sErr ? "#ff0000" : "#000000"; $style=" class='form_text' "; ?> <form name="frmFormMail" action="<?php print PHP_SELF ?>" method='post' enctype='multipart/form-data'> <input type='hidden' name='formmail_submit' value='Y'> <input type='hidden' name='esh_formmail_subject' value="Contact Form Submission"> <input type='hidden' name='esh_formmail_return_subject' value=""> <input type='hidden' name='esh_formmail_return_msg' value=""> <table cellspacing='16' cellpadding='0' border='0' > <tr> <td class="form_field" valign='top' align='right'>Business Name </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Business_Name" value="<?php print HtmlSpecialChars( $HTTP_POST_VARS[ "Business_Name" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Contact Name </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Contact_Name" value="<?php print HtmlSpecialChars( $_POST[ "Contact_Name" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Address Line 1 </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Address_Line_1" value="<?php print HtmlSpecialChars( $_POST[ "Address_Line_1" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Address Line 2 </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Address_Line_2" value="<?php print HtmlSpecialChars( $_POST[ "Address_Line_2" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>City </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="City" value="<?php print HtmlSpecialChars( $_POST[ "City" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>State </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="State" value="<?php print HtmlSpecialChars( $_POST[ "State" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Zip Code </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Zip_Code" value="<?php print HtmlSpecialChars( $_POST[ "Zip_Code" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Country </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Country" value="<?php print HtmlSpecialChars( $_POST[ "Country" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Phone Number </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="text" name="Phone_Number" value="<?php print HtmlSpecialChars( $_POST[ "Phone_Number" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Fax Number </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Fax_Number" value="<?php print HtmlSpecialChars( $_POST[ "Fax_Number" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Internet URL or AOL Keyword </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Internet_URL_or_AOL_Keyword" value="<?php print HtmlSpecialChars( $_POST[ "Internet_URL_or_AOL_Keyword" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Email </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="email" name="Email" value="<?php print HtmlSpecialChars( $_POST[ "Email" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Current or Projected monthly bankcard $ volume </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Current_or_Projected_monthly_bankcard_$_volume" value="<?php print HtmlSpecialChars( $_POST[ "Current_or_Projected_monthly_bankcard_$_volume" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Current or Projected AVERAGE ticket/sale amount </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Current_or_Projected_AVERAGE_ticket_sale_amount" value="<?php print HtmlSpecialChars( $_POST[ "Current_or_Projected_AVERAGE_ticket_sale_amount" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>Initials </td><td width='10' aligh='right' valign='top'></td> <td class="form_text"> <input type="text" name="Initials" value="<?php print HtmlSpecialChars( $_POST[ "Initials" ] ); ?>" class='text_box'> </td> </tr> <tr> <td class="form_field" valign='top' align='right'>I Accept all the Terms and Conditions </td><td width='10' aligh='right' valign='top'> <font size='2' color='#ff0000'>*</font> </td> <td class="form_text"> <input type="checkbox" name="Checkbox01_I_Accept_all_the_Terms_and_Conditions" value="" ?> > <br> </td> </tr> <tr><td colspan=3 align='center'><input type='submit' value='Submit'> <input type='button' value='Cancel' onclick="location.href='/';"></td></tr> </table> </form> <!-- End: --> <?php if( $sErr ) print "<script language='javascript' type='text/javascript'>location.href='#error';</script>";;; else: //!$isHideForm print( "<br><br><hr><center><b>Your form has been sent. Thank you.</b><br><br><input type='button' value='Home' onclick=\"location.href='/';\"></center><br><br>" ); endif; //!$isHideForm ?> <!-- footer --> <br /><br /> <div class='form_copyr'> </div> <p> </p> </center> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-2637029-29"; urchinTracker(); </script> </body> </html> Quote Link to comment Share on other sites More sharing options...
iarp Posted July 19, 2008 Share Posted July 19, 2008 What's located in 20080718-3c1f6feb98bad1e3ffbb0105e41e6bbf.lib.php ? It's being included and is where the errors coming from. Quote Link to comment Share on other sites More sharing options...
RAH Posted July 19, 2008 Author Share Posted July 19, 2008 <?php error_reporting(E_PARSE); define("ADMIN_MAIL", "jb@bwp.net"); define("HOST_NAME", $_SERVER['HTTP_HOST']); define("PHP_SELF", $_SERVER['PHP_SELF']); define("ERR_MISSING", "Missing required field : "); define("ERR_EMAIL", "Please enter a valid e-mail address : "); define("ERR_CREDIT_CARD_NUMBER", "Please check the credit card number : "); define("ERR_CREDIT_CARD_EXPIRED", "Please check the credit card expiry date : "); define("ERR_SELECT_UPLOAD", "Please select file : ");// recipient define('FORM_RECIPIENT', 'sales@yourwebdesignfirm.com'); // --- Array of Form Elements --- $form_mail[] = array( "name" => "Business_Name", "text" => "Business Name", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "Contact_Name", "text" => "Contact Name", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "Address_Line_1", "text" => "Address Line 1", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "Address_Line_2", "text" => "Address Line 2", "type" => "text", "required" => "" ) ; $form_mail[] = array( "name" => "City", "text" => "City", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "State", "text" => "State", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "Zip_Code", "text" => "Zip Code", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "Country", "text" => "Country", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "Phone_Number", "text" => "Phone Number", "type" => "text", "required" => "Required" ) ; $form_mail[] = array( "name" => "Fax_Number", "text" => "Fax Number", "type" => "text", "required" => "" ) ; $form_mail[] = array( "name" => "Internet_URL_or_AOL_Keyword", "text" => "Internet URL or AOL Keyword", "type" => "text", "required" => "" ) ; $form_mail[] = array( "name" => "Email", "text" => "Email", "type" => "email", "required" => "" ) ; $form_mail[] = array( "name" => "Current_or_Projected_monthly_bankcard_$_volume", "text" => "Current or Projected monthly bankcard $ volume", "type" => "text", "required" => "" ) ; $form_mail[] = array( "name" => "Current_or_Projected_AVERAGE_ticket_sale_amount", "text" => "Current or Projected AVERAGE ticket/sale amount", "type" => "text", "required" => "" ) ; $form_mail[] = array( "name" => "Initials", "text" => "Initials", "type" => "text", "required" => "" ) ; $form_mail[] = array( "name" => "I_Accept_all_the_Terms_and_Conditions", "text" => "I Accept all the Terms and Conditions", "type" => "checkbox", "required" => "Required" ) ; // -- Create new vars for checkPass() & sendFormMail() -- $I_Accept_all_the_Terms_and_Conditions = array(); $I_Accept_all_the_Terms_and_Conditions[0]=$HTTP_POST_VARS[ "Checkbox01_I_Accept_all_the_Terms_and_Conditions"]; $HTTP_POST_VARS[ "I_Accept_all_the_Terms_and_Conditions" ] = join( "\n", $I_Accept_all_the_Terms_and_Conditions); // -- Detech Submit & SendMail -- $isHideForm = false; if( $HTTP_POST_VARS["formmail_submit"] ){ $sErr = checkPass(); if( ! $sErr ){ sendFormMail( $form_mail, "") ; $isHideForm = true; $redirect = ""; if( strlen(trim($redirect)) ): header( "Location:$redirect" ); exit; endif; } } ?> <? // =============================================== function sendFormMail( $form_mail, $sFileName = "" ) { global $HTTP_POST_VARS ; if (ereg('/freeformmaker.com/', HOST_NAME)) { return; } $to = FORM_RECIPIENT; $from = "NO_REPLY@" . HOST_NAME; $subject = $HTTP_POST_VARS["esh_formmail_subject"]; // first stage keep it simple: $sWhatToDo = $sFileName ? "mailandfile" : "" ; //$HTTP_POST_VARS["esh_formmail_mail_and_file"]; //$sFileName = $HTTP_POST_VARS["esh_formmail_save_record_file"]; $cc = $HTTP_POST_VARS["esh_formmail_cc"]; $bcc = $HTTP_POST_VARS["esh_formmail_bcc"]; $charset = $HTTP_POST_VARS["esh_formmail_charset"]; for( $i = 0; $i < count( $form_mail ); $i ++ ){ $value = trim( $HTTP_POST_VARS[ $form_mail[ $i ][ "name" ] ] ); $content .= $form_mail[ $i ][ "text" ] . " \t : " . $value ."\n"; $line .= remove_newline( $value ) . "\t" ; if( strtolower("Sender's email") == strtolower($form_mail[ $i ][ "type" ]) ) { //print "Type:[" . $form_mail[ $i ][ "type" ] . "] $value <br>\n"; $from = $value ; } }; $content .= "\n\nIP:" . getEnv( "REMOTE_ADDR" ); switch( strtolower($sWhatToDo) ){ case "mailandfile" : mailAttachments( $to , $subject , $content, $from, $charset, $cc , $bcc ) ; if( ! appendToFile( $sFileName, $line ) ) mailReport( $content . "\n\nWrite Form Mail to File Fail." ); break; case "fileonly" : if( ! appendToFile( $sFileName, $line ) ) mailReport( $content . "\n\nWrite Form Mail to File Fail.", $from ); break; default : mailAttachments( $to , $subject , $content, $from, $charset, $cc , $bcc ) ; } mailAutoResponse( $from ) ; } //------------------------------------------------------------------------------------------ function mailAutoResponse( $to ){ global $HTTP_POST_VARS ; $subject = $HTTP_POST_VARS["esh_formmail_return_subject"]; $responseMsg = $HTTP_POST_VARS["esh_formmail_return_msg"]; if( $to && $responseMsg ) mail( $to, $subject, $responseMsg, "From: " . FORM_RECIPIENT); } //------------------------------------------------------------------------------------------ function mailReport( $content = "", $from = "" ){ mail( ADMIN_MAIL, "Error@" . HOST_NAME . PHP_SELF, $content, "From:$from" ); } //------------------------------------------------------------------------------------------ function remove_newline( $str = "" ){ $newliner = "<!--esh_newline-->" ; // replace \r\n with $newliner ; $newtaber = "<!--esh_newtaber-->" ; // replace \t with $newtaber ; $str = ereg_replace( "\t", $newtaber, $str ); $str = ereg_replace( "\r\n", $newliner, $str ); return ereg_replace( "\n", $newliner, $str ); } //------------------------------------------------------------------------------------------ function checkPass() { global $form_mail ; global $HTTP_POST_VARS ; global $HTTP_POST_FILES ; for( $i = 0; $i < count( $form_mail ); $i ++ ){ $type = strtolower( $form_mail[ $i ][ "type" ] ); $value = trim( $HTTP_POST_VARS[ $form_mail[ $i ][ "name" ] ] ); $required = $form_mail[ $i ][ "required" ] ; $text = stripslashes( $form_mail[ $i ][ "text" ] ); // simple check the field has something keyed in. if( !strlen($value) && ( $required == "Required" ) && $type != "attachment" ) return ERR_MISSING . $text ; // verify the special case /*if( ( strlen($value) || $type == "attachment" ) && $required == "Required" ): */ switch( $type ){ case strtolower("Sender's Name") : break; case strtolower("Generic email"): //case strtolower("Sender's email"): case "email": if( ! formIsEMail($value) ) return ERR_EMAIL . $text ; break; case "text" : break; case "textarea" : break; case "checkbox" : case "radio" : break; case "select" : break; case "attachment" : $upload_file = $HTTP_POST_FILES[ $form_mail[ $i ]["name"] ][ "tmp_name" ] ; if( ! is_uploaded_file($upload_file) ) return ERR_SELECT_UPLOAD . $text; break; case strtolower("Date(MM-DD-YYYY)"): break; case strtolower("Date(MM-YYYY)"): break; case strtolower("CreditCard(MM-YYYY)"): if( $value < date("Y-m") ) return ERR_CREDIT_CARD_EXPIRED . $text; break; case strtolower("CreditCard#"): if( !formIsCreditNumber( $value ) ) return ERR_CREDIT_CARD_NUMBER . $text ; break; case strtolower("Time(HH:MM:SS)"): break; case strtolower("Time(HH:MM)"): break; default : //return $sErrRequired . $form_mail[ $i ][ "text" ]; } // switch //endif; } // for return "" ; } //------------------------------------------------------------------------------------------ function formSelected( $var, $val ) { echo ( $var == $val ) ? "selected" : ""; } //------------------------------------------------------------------------------------------ function formChecked( $var, $val ) { echo ( $var == $val ) ? "checked" : ""; } //------------------------------------------------------------------------------------------ function formIsEMail( $email ){ return ereg( "^(.+)@(.+)\\.(.+)$", $email ); } //------------------------------------------------------------------------------------------ function selectList( $name, $selectedValue, $start, $end, $prompt = "-Select-", $style = "" ) { $tab = "\t" ; print "<select name=\"$name\" $style>\n" ; print $tab . "<option value=''>$prompt</option>\n" ; $nLen = strlen( "$end" ) ; $prefix_zero = str_repeat( "0", $nLen ); for( $i = $start; $i <= $end ; $i ++ ){ $stri = substr( $prefix_zero . $i, strlen($prefix_zero . $i)-$nLen, $nLen ); $selected = ( $stri == $selectedValue ) ? " selected " : "" ; print $tab . "<option value=\"$stri\" $selected >$stri</option>\n" ; } print "</select>\n\n" ; } //------------------------------------------------------------------------------------------ // something like CreditCard.pm in perl CPAN function formIsCreditNumber( $number ) { $tmp = $number; $number = preg_replace( "/[^0-9]/", "", $tmp ); if ( preg_match( "/[^\d\s]/", $number ) ) return 0; if ( strlen($number) < 13 && 0+$number ) return 0; for ($i = 0; $i < strlen($number) - 1; $i++) { $weight = substr($number, -1 * ($i + 2), 1) * (2 - ($i % 2)); $sum += (($weight < 10) ? $weight : ($weight - 9)); } if ( substr($number, -1) == (10 - $sum % 10) % 10 ) return $number; return $number; } // -------------------------- Begin Mail Attachment Functions ----------------------------------------------------------------- function mailAttachments( $to = "" , $subject = "" , $message = "" , $from = "support@lynx.net" , $charset = "iso-8859-1", $cc = "" , $bcc = "" ){ global $HTTP_POST_FILES ; if( ! strlen( trim( $to ) ) ) return "Missing \"To\" Field." ; $boundary = "====_My_PHP_Form_Generator_" . md5( uniqid( srand( time() ) ) ) . "===="; // setup mail header infomation $headers = "From: $from\r\n"; if ($cc) $headers .= "CC: $cc\r\n"; if ($bcc) $headers .= "BCC: $bcc\r\n"; $plainHeaders = $headers ; // for no attachments header $headers .= "MIME-Version: 1.0\nContent-type: multipart/mixed;\n\tboundary=\"$boundary\"\n"; $txtMsg = "\nThis is a multi-part message in MIME format.\n" . "\n--$boundary\n" . "Content-Type: text/plain;\n\tcharset=\"$charset\"\n\n" . $message . "\n"; //create mulitipart attachments boundary $sError = "" ; $nFound = 0; foreach( $HTTP_POST_FILES as $aFile ){ $sFileName = $aFile[ "tmp_name" ] ; $sFileRealName = $aFile[ "name" ] ; if( is_file( $sFileName ) ): if( $fp = fopen( $sFileName, "rb" ) ) : $sContent = fread( $fp, filesize( $sFileName ) ); $sFName = basename( $sFileRealName ) ; $sMIME = getMIMEType( $sFName ) ; $bPlainText = ( $sMIME == "text/plain" ) ; if( $bPlainText ) : $encoding = "" ; else: $encoding = "Content-Transfer-Encoding: base64\n"; $sContent = chunk_split( base64_encode( $sContent ) ); endif; $sEncodeBody .= "\n--$boundary\n" . "Content-Type: $sMIME;\n" . "\tname=\"$sFName\"\n" . $encoding . "Content-Disposition: attachment;\n" . "\tfilename=\"$sFName\"\n\n" . $sContent . "\n" ; $nFound ++; else: $sError .= "<br>File $sFileName can not open.\n" ; endif; // if( $fp = fopen( $sFileName, "rb" ) ) : else: $sError .= "<br>File $sFileName doesn't exist.\n" ; endif; //if( file_exists( $sFileName ) ): }; // end foreach $sEncodeBody .= "\n\n--$boundary--" ; $sSource = $txtMsg . $sEncodeBody ; $nFound ? mail( $to, $subject, $sSource, $headers ) : mail( $to, $subject, $message, $plainHeaders ); return $sError ; } /* --------------------------------------------------------------------------------------------------- Parameters: $sFileName Return : 1. "" : no extendsion name, or sFileName is empty 2. string: MIME Type name of array aMimeType's definition. ---------------------------------------------------------------------------------------------------*/ function getMIMEType( $sFileName = "" ) { $sFileName = strtolower( trim( $sFileName ) ); if( ! strlen( $sFileName ) ) return ""; $aMimeType = array( "txt" => "text/plain" , "pdf" => "application/pdf" , "zip" => "application/x-compressed" , "html" => "text/html" , "htm" => "text/html" , "avi" => "video/avi" , "mpg" => "video/mpeg " , "wav" => "audio/wav" , "jpg" => "image/jpeg " , "gif" => "image/gif" , "tif" => "image/tiff " , "png" => "image/x-png" , "bmp" => "image/bmp" ); $aFile = split( "\.", basename( $sFileName ) ) ; $nDiminson = count( $aFile ) ; $sExt = $aFile[ $nDiminson - 1 ] ; // get last part: like ".tar.zip", return "zip" return ( $nDiminson > 1 ) ? $aMimeType[ $sExt ] : ""; } // End Mail Attachment Functions //------------------------------------------------------------------------------------------ function appendToFile( $sFileName = "", $line = "" ){ if( !$sFileName || !$line ) return 0; $hFile = fopen( "$sFileName", "a+w" ); $nBytes = 0; if( $hFile ){ $nBytes = fputs( $hFile , trim($line)."\r\n" ); fclose( $hFile ); }; return $nBytes ; } ?> Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted July 19, 2008 Share Posted July 19, 2008 change error_reporting(E_PARSE); to error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
RAH Posted July 19, 2008 Author Share Posted July 19, 2008 Done and now get these errors: Notice: Undefined variable: _volume in /home/content/j/a/m/jamiequeens/html/20080718-3c1f6feb98bad1e3ffbb0105e41e6bbf.lib.php on line 25 Notice: Undefined index: Checkbox01_I_Accept_all_the_Terms_and_Conditions in /home/content/j/a/m/jamiequeens/html/20080718-3c1f6feb98bad1e3ffbb0105e41e6bbf.lib.php on line 33 Notice: Undefined index: formmail_submit in /home/content/j/a/m/jamiequeens/html/20080718-3c1f6feb98bad1e3ffbb0105e41e6bbf.lib.php on line 41 Quote Link to comment Share on other sites More sharing options...
RAH Posted July 20, 2008 Author Share Posted July 20, 2008 Anyone? Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted July 20, 2008 Share Posted July 20, 2008 then work on fixing the errors. Quote Link to comment Share on other sites More sharing options...
RAH Posted July 20, 2008 Author Share Posted July 20, 2008 The reason I posted here was because I didn't know how to fix the errors... Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted July 20, 2008 Share Posted July 20, 2008 It gives you the line numbers go and check the lines. Quote Link to comment Share on other sites More sharing options...
RAH Posted July 20, 2008 Author Share Posted July 20, 2008 I've fixed the first error but not sure how to fix the other 2. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted July 20, 2008 Share Posted July 20, 2008 show the two lines where they are Quote Link to comment Share on other sites More sharing options...
RAH Posted July 20, 2008 Author Share Posted July 20, 2008 show the two lines where they are The code is posted in the 6th reply above. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted July 20, 2008 Share Posted July 20, 2008 yes but i am not counting the lines to find it , post the lines where the error is or don't pm me for help Quote Link to comment Share on other sites More sharing options...
RAH Posted July 20, 2008 Author Share Posted July 20, 2008 Sorry, here you go. Lines 31-34 // -- Create new vars for checkPass() & sendFormMail() -- $I_Accept_all_the_Terms_and_Conditions = array(); $I_Accept_all_the_Terms_and_Conditions[0]=$HTTP_POST_VARS[ "Checkbox01_I_Accept_all_the_Terms_and_Conditions"]; $HTTP_POST_VARS[ "I_Accept_all_the_Terms_and_Conditions" ] = join( "\n", $I_Accept_all_the_Terms_and_Conditions); Lines 39-53 // -- Detech Submit & SendMail -- $isHideForm = false; if( $HTTP_POST_VARS["formmail_submit"] ){ $sErr = checkPass(); if( ! $sErr ){ sendFormMail( $form_mail, "") ; $isHideForm = true; $redirect = ""; if( strlen(trim($redirect)) ): header( "Location:$redirect" ); exit; endif; } } Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted July 20, 2008 Share Posted July 20, 2008 ok , first off change all HTTP_POST_VARS['']; to $_POST['']; Quote Link to comment Share on other sites More sharing options...
RAH Posted July 20, 2008 Author Share Posted July 20, 2008 OK, now I'm getting this: Notice: Undefined index: Checkbox01_I_Accept_all_the_Terms_and_Conditions in /home/content/j/a/m/jamiequeens/html/20080718-3c1f6feb98bad1e3ffbb0105e41e6bbf.lib.php on line 33 Notice: Undefined index: formmail_submit in /home/content/j/a/m/jamiequeens/html/20080718-3c1f6feb98bad1e3ffbb0105e41e6bbf.lib.php on line 41 And all the boxes are filled with this: <br /> <b>Notice</b>: Undefined index: Business_Name in <b>/home/content/j/a/m/jamiequeens/html/form.php</b> on line <b>109</b><br /> Quote Link to comment Share on other sites More sharing options...
joquius Posted July 20, 2008 Share Posted July 20, 2008 First of all checking for form submissions with "if ($_POST['cake'])" will throw warnings when nothing is posted. Better to use "if (isset ($_POST['pudding']))". "Checkbox01_I_Accept_all_the_Terms_and_Conditions" has to be the name of a posted field. As far as I can see, there's no such form input field setup anywhere in your code with that name. If you want to find out what fields are being posted you can just get php to vomit them out for you: var_dump ($_POST); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.