Ninjakreborn Posted March 14, 2007 Share Posted March 14, 2007 <?php ini_set('display_errors', 'On'); ini_set('log_errors', 'Off'); /* ########### CONFIGURE THESE VARIABLES ########### */ $recipient = 'asdfsdfsdf'; // Email Address $domain = ''; // Your domain Address LOWERCASE!!! $description ='Thank you for contacting us'; // Email subject line for person who has applyed $description2 ='New Charity Application'; // Email subject line for admin notification $autoresponder = 'yes'; // yes to use autoresponder or no will skip the autoresponder feature /* ########### FORM VARIABLES ########### */ /* ########### STARTUP ########### $domain = strtolower($domain); $calling_page = $_SERVER["HTTP_HOST"]; $matches = strtolower($calling_page); preg_match("/[^\.\/]+\.[^\.\/]+$/", $calling_page, $matches); preg_match("/[^\.\/]+\.[^\.\/]+$/", $domain, $dmatches); if ($matches == $dmatches) {} else { echo "<br><br><br><center><font size=5 color=blue>Invalid Use of Form!</b></font><br><br><b>Please hit your browser's \"back\" button and try again.</b></center><br>"; exit; } */ global $_POST ; $delete = array('*','|','>','<','meta','\\','\"','..', '\''); foreach($_POST as $key => $value) { $value = trim($value); //remove whitespace $value = str_replace($delete, "", $value); $value = htmlspecialchars($value); $value = strip_tags($value); $value = stripslashes($value); $$key = $value; if (strlen($value) > 10000) { echo "<br><br><br><center><font size=5 color=blue>You have exceeded the upload limit!</b></font><br><br><b>Please hit your browser's \"back\" button and try again.</b></center><br>"; exit; } } /* ########### STOP FLOOD ########### */ $ip = $_SERVER['REMOTE_ADDR']; include "sqlconn.php"; $query = 'SELECT * FROM `Application_Form` LIMIT 0, 30 '; $result = mysql_query($query); if (empty($lastname)) { $lastname = NULL; } if (empty($phone)) { $phone = NULL; } if (empty($typerequest)) { $typerequest = NULL; } if (empty($grant)) { $grant = NULL; } if (empty($relate)) { $relate = NULL; } if (empty($t1)) { $t1 = NULL; } if (empty($ftn)) { $ftn = NULL; } if (empty($a1)) { $a1 = NULL; } if (empty($a2)) { $a2 = NULL; } if (empty($error11)) { $error11 = NULL; } if (empty($select1)) { $select1 = NULL; } if (empty($t1)) { $t1 = NULL; } if (empty($tc)) { $tc = NULL; } if (empty($pcs)) { $pcs = NULL; } if (empty($email)) { $email = NULL; } if (empty($error12)) { $error12 = NULL; } if (empty($select4)) { $select4 = NULL; } if (empty($outlinerequest)) { $outlinerequest = NULL; } if (empty($detailsrequest)) { $detailsrequest = NULL; } if (empty($select8)) { $select8 = NULL; } if (empty($t12)) { $t12 = NULL; } if (empty($ftn2)) { $ftn2 = NULL; } if (empty($a12)) { $a12 = NULL; } if (empty($a22)) { $a22 = NULL; } if (empty($email2)) { $email2 = NULL; } if (empty($tc2)) { $ltc2 = NULL; } if (empty($psc2)) { $psc2 = NULL; } if (empty($tl2)) { $tl2 = NULL; } if (empty($ltn2)) { $ltn2 = NULL; } if (empty($tl)) { $tl = NULL; } if (empty($psc)) { $psc = NULL; } if (empty($phone2)) { $phone2 = NULL; } if (empty($tc2)) { $tc2 = NULL; } // here if (empty($error1)) { $error1 = NULL; } if (empty($error2)) { $error2 = NULL; } if (empty($error3)) { $error3 = NULL; } if (empty($error4)) { $error4 = NULL; } if (empty($error5)) { $error5 = NULL; } if (empty($error6)) { $error6 = NULL; } if (empty($error7)) { $error7 = NULL; } if (empty($error8)) { $error8 = NULL; } if (empty($error9)) { $error9 = NULL; } if (empty($error)) { $error = NULL; } if (empty($error13)) { $error13 = NULL; } if (empty($error14)) { $error14 = NULL; } while($row = mysql_fetch_row($result)) { $getlastname = $row[3]; if ($getlastname == $lastname) { $error = "Please fix the following errors!"; $spamerror = "We already have your details on file"; } } mysql_close(); /* ########### Field Verification ########### */ if (empty($tl)) { $error = "Please fix the following errors!"; $error1 = <<<EOD This is a required field! EOD; } if (empty($ftn)) { $error = "Please fix the following errors!"; $error2 = <<<EOD This is a required field! EOD; } if (empty($lastname)) { $error = "Please fix the following errors!"; $error3 = <<<EOD This is a required field! EOD; } if (empty($dob)) { $error = "Please fix the following errors!"; $error4 = <<<EOD This is a required field! EOD; $dob = "dd/mm/yyyy"; } if ($dob == "ddmmyyyy") { $error = "Please fix the following errors!"; $error4 = <<<EOD Enter a valid date! EOD; $dob = "dd/mm/yyyy"; } list($month, $day, $year) = split('[/]', $dob); $pattern = '([0-9]{2})'; // 2 digits $pattern2 = '([0-9]{4})'; // 4 digits $pattern3 = '([0-9]{8})'; // 8 digits if (ereg($pattern, $month, $regs)) {} else { $error = "Please fix the following errors!"; $error4 = <<<EOD Date format incorrect! EOD; } if (ereg($pattern, $day, $regs)) {} else { $error = "Please fix the following errors!"; $error4 = <<<EOD Date format incorrect! EOD; } if (ereg($pattern, $year, $regs)) {} else { $error = "Please fix the following errors!"; $error4 = <<<EOD Date format incorrect! EOD; } if (strlen($dob) != "10") { $error = "Please fix the following errors!"; $error4 = <<<EOD Date format incorrect! EOD; } if (empty($a1)) { $error = "Please fix the following errors!"; $error5 = <<<EOD This is a required field! EOD; } if (empty($a2)) { $error = "Please fix the following errors!"; $error6 = <<<EOD This is a required field! EOD; } if (empty($tc)) { $error = "Please fix the following errors!"; $error7 = <<<EOD This is a required field! EOD; } if (empty($psc)) { $error = "Please fix the following errors!"; $error8 = <<<EOD This is a required field! EOD; } if (empty($phone)) { $error = "Please fix the following errors!"; $error9 = <<<EOD This is a required field! EOD; } $pattern5 = '([a-zA-Z])'; if (!ereg($pattern5, $phone, $regs)) {} else { $error = "Please fix the following errors!"; $error9 = <<<EOD Phone format incorrect! EOD; } if (empty($email)) {} else{ $Vemail = ereg ("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $email ); if (!$Vemail) { $error = "Please fix the following errors!"; $error10 = <<<EOD Enter a valid email address! EOD; } } if ($typerequest == "Please Select") { $error = "Please fix the following errors!"; $error11 = <<<EOD This is a required field!<br> EOD; } if ($grant == "Please Select") { $error = "Please fix the following errors!"; $error12 = <<<EOD This is a required field!<br> EOD; } if (empty($outlinerequest)) { $error = "Please fix the following errors!"; $error13 = <<<EOD This is a required field! EOD; } if (empty($detailsrequest)) { $error = "Please fix the following errors!"; $error14 = <<<EOD This is a required field! EOD; } if (empty($ftn2)) {} else { if ($relate == "Please Select") { $error = "Please fix the following errors!"; $error15 = <<<EOD This is a required field!<br> EOD; } if (empty($tl2)) { $error = "Please fix the following errors!"; $error16 = <<<EOD This is a required field!<br> EOD; } if (empty($ftn2)) { $error = "Please fix the following errors!"; $error17 = <<<EOD This is a required field!<br> EOD; } if (empty($ltn2)) { $error = "Please fix the following errors!"; $error18 = <<<EOD This is a required field!<br> EOD; } if (empty($a12)) { $error = "Please fix the following errors!"; $error19 = <<<EOD This is a required field!<br> EOD; } if (empty($a22)) { $error = "Please fix the following errors!"; $error20 = <<<EOD This is a required field!<br> EOD; } if (empty($tc2)) { $error = "Please fix the following errors!"; $error21 = <<<EOD This is a required field!<br> EOD; } if (empty($psc2)) { $error = "Please fix the following errors!"; $error22 = <<<EOD This is a required field!<br> EOD; } if (empty($phone2)) { $error = "Please fix the following errors!"; $error23 = <<<EOD This is a required field!<br> EOD; } $pattern6 = '([a-zA-Z])'; if (!ereg($pattern5, $phone2, $regs)) {} else { $error = "Please fix the following errors!"; $error23 = <<<EOD Phone format incorrect!<br> EOD; } if (empty($email2)) {} else{ $Vemail = ereg ("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $email2 ); if (!$Vemail) { $error = "Please fix the following errors!"; $error24 = <<<EOD Enter a valid email address!<br> EOD; } } } if ($typerequest == "Please Select" ) {$select1 = "selected";} if ($typerequest == "Individual" ) {$select2 = "selected";} if ($typerequest == "Organisation" ) {$select3 = "selected";} if ($grant == "Please Select" ) {$select4 = "selected";} if ($grant == "Up to - £1000" ) {$select5 = "selected";} if ($grant == "Up to - £3000" ) {$select6 = "selected";} if ($grant == "Up to - £5000" ) {$select7 = "selected";} if ($relate == "Please Select" ) {$select8 = "selected";} if ($relate == "Carer" ) {$select9 = "selected";} if ($relate == "Friend" ) {$select10 = "selected";} if ($relate == "Therapist" ) {$select11 = "selected";} if ($relate == "Representative of institution" ) {$select12 = "selected";} if ($relate == "Other" ) {$select13 = "selected";} /* ########### ERROR PAGE ########### */ if (empty($spamerror)) { $spamerror = NULL; } if (empty($error10)) { $error10 = NULL; } if (empty($select2)) { $select2 = NULL; } if (empty($select3)) { $select3 = NULL; } if (empty($select5)) { $select5 = NULL; } if (empty($select6)) { $select6 = NULL; } if (empty($select7)) { $select7 = NULL; } if (empty($error15)) { $error15 = NULL; } if (empty($select9)) { $select9 = NULL; } if (empty($select10)) { $select10 = NULL; } if (empty($select11)) { $select11 = NULL; } if (empty($select12)) { $select12 = NULL; } if (empty($select13)) { $select13 = NULL; } if (empty($error16)) { $error16 = NULL; } if (empty($error17)) { $error17 = NULL; } if (empty($error18)) { $error18 = NULL; } if (empty($error19)) { $error19 = NULL; } if (empty($error20)) { $error20 = NULL; } if (empty($error21)) { $error21 = NULL; } if (empty($error22)) { $error22 = NULL; } if (empty($error23)) { $error23 = NULL; } if (empty($error24)) { $error24 = NULL; } $errorpage = <<<EOD <html> <head> <script type="text/JavaScript"> <!-- function wipe (obj) { obj.value = ""; } //--> </script> <script type="text/javascript"> function clickclear(thisfield, defaulttext) { if (thisfield.value == defaulttext) { thisfield.value = ""; } } function clickrecall(thisfield, defaulttext) { if (thisfield.value == "") { thisfield.value = defaulttext; } } </script> <title>sf group | Application Form </title> <link href="main.css" rel="stylesheet" type="text/css"> <link href="app.css" rel="stylesheet" type="text/css"> </head> <body background="images/gradient.jpg"> <table id='f_t' border="1" align="center"><!-- t1--> <tr> <td id='f_hc'> <a href='index.htm'> <img src="images/banner.jpg" border='0' title='sf group - charity website' alt='image missing'> </a> </td> </tr> <tr> <td id='body_c' align='center'> <table width="100%" height="270" border="0" style='border: 0 solid'><!-- t2--> <tr> <td id='menu_c'> <div id="menu5"> <p id='home'><a id='t' href="index.htm" title="Home">Home</a></p> <p id='news'><a id='t' href="news.php" title="News">News</a></p> <p id='about'><a id='t' href="about.htm" title="About Us">About Us</a></p> <p id='application_sel'><a id='t' href="application.htm" title="Application Form">Application Form</a></p> <p id='contact'><a id='t' href="contact.htm" title="Contact Us">Contact Us</a></p> <p id='faq'><a id='t' href="faq.htm" title="FAQ's">FAQ's</a></p> <p id='info'><a id='t' href="financialinfo.php" title="Financial Information">Financial Information</a></p> <p id='donations'><a id='t' href="previousdonations.htm" title="Funded Items">Funded Items</a></p> <p id='company'><a id='t' href="http://www.sfgroup.com" target="_blank" title="sf group company website">sf group</a></p> </div> </td> <td id='content_c' align="left" valign="top"> <form name="form1" method="post" action="formapplication.php"> <table width="100%" height="270" border="0"> <!-- t3--> <tr> <td id='image'> <img src="images/form.jpg" title='Application Form' alt='image missing' width="102" height="99" align="left"> </td> <td id='txt' valign='top'> <b>Application Form</b> <p style='width: 340'> On this page you will be able to apply for support by using the form below and filling in the appropriate sections. </td> </tr> <tr> <td id='txt' colspan='2'> <hr size="1" noshade> <table height="270" border="0"> <tr> <td id='txt' colspan='2'> <div align="left"> <p>If you are the person for whom help is being sought, please fill in section 1 only. If you are applying on behalf of someone else, please fill in sections 1 & 2.<br> <br> Supporting documentation is welcomed; please send to our <a href='contact.htm'>freepost address.</a> <br> If estimates are being sent, please send more than one if possible.<br> <br> <b>Please ensure all relevant fields are completed.</b><br> <br> <b>Section 1</b> <br> Details of person/people for whom help is being sought.<br> </p> <p align="center"><font color="#FF0000">* Please fix the following errors! <br>$spamerror</font><br> </p> </div> </td> </tr> <tr> <td id='ptxt' width="228">Title:</td> <td style='' width="288"> <font size="2" color="#FF0000">$error1</font> <input type="text" name="tl" value="$tl"> </td> </tr> <tr> <td id='ptxt' width="228">First Name:</td> <td width="288"> <font size="2" color="#FF0000">$error2</font> <input type="text" name="ftn" value="$ftn"> </td> </tr> <tr> <td id='ptxt' width="228">Last Name:</td> <td width="288"> <font size="2" color="#FF0000">$error3</font> <input type="text" name="lastname" value="$lastname"> </td> </tr> <tr> <td id='ptxt' width="228">Date of Birth: </td> <td width="288"> <font size="2" color="#FF0000">$error4</font> <input onclick="clickclear(this, 'dd/mm/yyyy')" onblur="clickrecall(this,'dd/mm/yyyy')" type="text" name="dob" value="$dob"> </td> </tr> <tr> <td id='ptxt' width="228">Address 1:</td> <td width="288"> <font size="2" color="#FF0000">$error5</font> <input type="text" name="a1" value="$a1"> </td> </tr> <tr> <td id='ptxt' width="228">Address 2:</td> <td width="288"> <font size="2" color="#FF0000">$error6</font> <input type="text" name="a2" value="$a2"> </td> </tr> <tr> <td id='ptxt' width="228">Town/City:</td> <td width="288"> <font size="2" color="#FF0000">$error7</font> <input type="text" name="tc" value="$tc"> </td> </tr> <tr> <td id='ptxt' width="228">Postcode:</td> <td width="288"> <font size="2" color="#FF0000">$error8</font> <input type="text" name="psc" value="$psc"> </td> </tr> <tr> <td id='ptxt' width="228">Phone:</td> <td width="288"> <font size="2" color="#FF0000">$error9</font> <input type="text" name="phone" value="$phone"> </td> </tr> <tr> <td id='ptxt' width="228">Email:</td> <td width="288"> <font size="2" color="#FF0000">$error10</font> <input type="text" name="email" value="$email"> </td> </tr> <tr> <td id='ptxt' width="228">Type of request:</td> <td width="288"> <font size="2" color="#FF0000">$error11</font> <select name="typerequest"> <option $select1>Please Select <option $select2>Individual <option $select3>Organisation </select> <br> </td> </tr> <tr> <td id='ptxt' width="228">Amount of grant required:</td> <td width="288"> <font size="2" color="#FF0000">$error12</font> <select name="grant"> <option $select4>Please Select <option $select5>Up to - £1000 <option $select6>Up to - £3000 <option $select7>Up to - £5000 </select> <br> </td> </tr> <tr> <td id='ptxt' width="228">Brief outline of disability:</td> <td width="288"> <font size="2" color="#FF0000">$error13</font> <textarea name="outlinerequest">$outlinerequest</textarea> </td> </tr> <tr> <td id='ptxt' width="228">Details of request:</td> <td width="288"> <font size="2" color="#FF0000">$error14</font> <textarea name="detailsrequest">$detailsrequest</textarea> </td> </tr> </table> <table width="100%" height="270" border="0"> <tr> <td id='qtxt' colspan='2'><b>Section 2</b><br> Relationship to person/people above <font size="2" color="#FF0000">$error15</font> <select name="relate"> <option $select8>Please Select <option $select9>Carer <option $select10>Friend <option $select11>Therapist <option $select12>Representative of institution <option $select13>Other </select> <br> <br> </td> </tr> <tr> <td id='ptxt'>Title:</td> <td style=''> <font size="2" color="#FF0000">$error16</font> <input type="text" name="tl2" value="$tl2"> </td> </tr> <tr> <td id='ptxt'>First Name:</td> <td> <font size="2" color="#FF0000">$error17</font> <input type="text" name="ftn2" value="$ftn2"> </td> </tr> <tr> <td id='ptxt'>Last Name:</td> <td> <font size="2" color="#FF0000">$error18</font> <input type="text" name="ltn2" value="$ltn2"> </td> </tr> <tr> <td id='ptxt'>Address 1:</td> <td> <font size="2" color="#FF0000">$error19</font> <input type="text" name="a12" value="$a12"> </td> </tr> <tr> <td id='ptxt'>Address 2:</td> <td> <font size="2" color="#FF0000">$error20</font> <input type="text" name="a22" value="$a22"> </td> </tr> <tr> <td id='ptxt'>Town/City:</td> <td> <font size="2" color="#FF0000">$error21</font> <input type="text" name="tc2" value="$tc2"> </td> </tr> <tr> <td id='ptxt'>Postcode:</td> <td> <font size="2" color="#FF0000">$error22</font> <input type="text" name="psc2" value="$psc2"> </td> </tr> <tr> <td id='ptxt'>Phone:</td> <td> <font size="2" color="#FF0000">$error23</font> <input type="text" name="phone2" value="$phone2"> </td> </tr> <tr> <td id='ptxt'>Email:</td> <td><font size="2" color="#FF0000">$error24</font> <input type="text" name="email2" value="$email2"> </td> </tr> <tr> <td colspan='2' id='but'> <input type="submit" value="Submit" name="submit"> </td> </tr> <tr> <td id='txt' colspan='2'> If you have any questions regarding this form or it does not meet your needs, please feel free to email dhdfhg <hr size="1" noshade> </td> </tr> </table> </table> <!-- 3 --> </form> <p> </p> </td> </tr> </table> <!-- 2 --> </td> </tr> <tr> <td><img src="images/footer.jpg" width="790" height="70"></td> </tr> </table> <!-- t1 --> </body> </html> EOD; /* ########### END OF ERROR PAGE ########### */ if ($error == "Please fix the following errors!") { echo "$errorpage"; exit; } /* ########### ADMIN EMAIL ########### */ $to = "$recipient"; $from = "$email"; $subject = "$description2"; $message = <<<EOD ------------------------------ <br><br> <br>SECTION 1 <br><br> Title: $tl <br> First Name: $ftn <br> Last Name: $lastname <br> Date of Birth: $dob <br> Address 1: $a1 <br> Address 2: $a2 <br> Town/City: $tc <br> Postcode: $psc <br> Phone: $phone <br> Email: $email <br> Type of request:: $typerequest <br> Amount of grant required: $grant <br> Brief outline of disability: $outlinerequest <br> Details of request: $detailsrequest <br> <br>SECTION 2 <br><br> Relationship to person/people above: $relate <br> Title: $tl2 <br> First Name: $ftn2 <br> Last Name: $ltn2 <br> Address 1: $a12 <br> Address 2: $a22 <br> Town/City: $tc2 <br> Postcode: $psc2 <br> Phone: $phone2 <br> Email: $email2 <br> EOD; $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($to, $subject, $message, $headers); /* ########### AUTORESPONDER 1 ########### */ if ($email != "") { $to = "$email"; $from = "$recipient"; $subject = "$description"; $message = <<<EOD <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> Thank you for submitting the Application Form, the Fund Manager will be in <br> touch within two weeks to discuss your request in more detail. dfghdfgh <p>Reg. Charity No. 1104927</p> <p>m 07711 985 758</p> dfghdfgh </p> </body> </html> EOD; $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($to, $subject, $message, $headers); } /* ########### AUTORESPONDER 2 ########### */ if ($email2 != "") { $to = "$email2"; $from = "$recipient"; $subject = "$description"; $message = <<<EOD <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> Thank you for submitting the Application Form, the Fund Manager will be in <br> touch within two weeks to discuss your request in more detail. <p> </p> <p>Regards,</p> <p>Brenda Yong</p> <p>Fund Manager</p> <p>dfghdfgh</p> <p>Reg. Charity No. 1104927</p> <p>m 07711 985 758</p> <p><a href="mailto:dfghdfgh">dfghdfgh</a></p> <p><a href="gfhfgh">dfghdfgh</a><br> </p> </body> </html> EOD; $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($to, $subject, $message, $headers); } /* ########### RESULTS PAGE ########### */ $resultspage = <<<EOD <html> <head> <title>sf group | Form Submitted </title> <link href="main.css" rel="stylesheet" type="text/css"> </head> <body background="images/gradient.jpg"> <table id='f_t' border="1" align="center"><!-- t1--> <tr> <td id='f_hc'> <a href='index.htm'> <img src="images/banner.jpg" border='0' title='sf group - charity website' alt='image missing'> </a> </td> </tr> <tr> <td id='body_c' align='center'> <table width="100%" height="270" border="0" style='border: 0 solid'><!-- t2--> <tr> <td id='menu_c' height="271"> <div id="menu5"> <p id='home'><a id='t' href="index.htm" title="Home">Home</a></p> <p id='news'><a id='t' href="news.php" title="News">News</a></p> <p id='about'><a id='t' href="about.htm" title="About Us">About Us</a></p> <p id='application_sel'><a id='t' href="application.htm" title="Application Form">Application Form</a></p> <p id='contact'><a id='t' href="contact.htm" title="Contact Us">Contact Us</a></p> <p id='faq'><a id='t' href="faq.htm" title="FAQ's">FAQ's</a></p> <p id='info'><a id='t' href="financialinfo.php" title="Financial Information">Financial Information</a></p> <p id='donations'><a id='t' href="previousdonations.htm" title="Funded Items">Funded Items</a></p> <p id='company'><a id='t' href="uuu" target="_blank" title="sf group company website">sf group</a></p> </div> </td> <td id='content_c' height="271"> <table width="100%" height="175" border="0"><!-- t3--> <tr> <td id='image'> <img src="images/form.jpg" title='Application Form' alt='image missing' width="102" height="99" align="left"> </td> <td id='txt' valign='top'> <b>Application Form</b> <p style='width: 400'> Thank for for submitting your application form. We will get back to you as soon as possible. </td> </tr> <tr> <td id='txt' colspan='2'> <hr size="1" noshade> </td> </tr> </table> </td> </tr> </table><!-- t2--> </td> </tr> <tr> <td><img src="images/footer.jpg" width="790" height="70"></td> </tr> </table><!-- t1--> </body> </html> EOD; echo "$resultspage"; /* ########### END OF RESULTS PAGE ########### */ /* ########### DATABASE ########### */ include "sqlconn.php"; $query = "INSERT INTO Application_Form VALUES ('','$tl','$ftn','".$lastname."','$dob','$a1','$a2','$tc','$psc','$phone','$email','$typerequest','$grant','$outlinerequest','$detailsrequest','$relate','$tl2','$ftn2','$ltn2','$a12','$a22','$tc2','$psc2','$phone2','$email2')"; //echo $query; $go = mysql_query($query) or die(mysql_error()); ?> ive got this - Parse error: syntax error, unexpected '=', expecting '}' in /htdocs/charity/formapplication.php on line 417 For some reason there is a syntax error, the line is if ($typerequest == "Please Select" ) {$select1 = "selected";} if ($typerequest == "Individual" ) {$select2 = "selected";} if ($typerequest == "Organisation" ) {$select3 = "selected";} I just don't understand how this error is coming about. Quote Link to comment https://forums.phpfreaks.com/topic/42682-solved-syntax-error/ Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 if ($typerequest == "Please Select" ) $select1 = "selected"; if ($typerequest == "Individual" ) $select2 = "selected"; if ($typerequest == "Organisation" ) $select3 = "selected"; try that. --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42682-solved-syntax-error/#findComment-207158 Share on other sites More sharing options...
Nameless12 Posted March 14, 2007 Share Posted March 14, 2007 I wouldn't of said anything but you are repeating your self quite a lot in the code, too often for it to be a good thing. I dont quite know why you have all the $error vars, have you considered the below? <?php $error = array(); if (!isset($_POST['user_name')) $error[] = 'some message here'; ?> then you can later just do <?php foreach ($error as $message) echo $message; ?> If something is empty() then it can be false\null or zero there is no need to set an empty value to null as you have done My last critque I will share is I get the impression you have done a select * from application in order to see if someone has submitted the form previously?? There is no need to select everything you only need to select th data you need. select * is not the best performance wise when you only need one field. After you get the data you are doing a loop over the sql results to check if a user is already in the results this is very bad for performance\readability and such Have you considered "SELECT COUNT(*) FROM app WHERE last_name = '$last_name'"; ?? Quote Link to comment https://forums.phpfreaks.com/topic/42682-solved-syntax-error/#findComment-207164 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.