This is the message I receive when I test submit a form I have created, "You request could not be processed due to a system error. We apologize for any inconvenience", but I am not sure if it is my script or the table settings that is at fault. This is the image I have of the table in question, This is the code for the php script' <?php ob_start(); session_start(); // Include the configuration file for error management and such. require_once ('includes/config.inc.php'); if (isset($_POST['Send'])) { // Handle the form. require_once ('includes/mysql_connect.php'); // Connect to the database. // Check for an email address. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,40}$', stripslashes(trim($_POST['email'])))) { $e = escape_data($_POST['email']); } else { $e = FALSE; echo '<p>Please enter a valid email address!</p>'; } // Check for pages quantity. if (eregi ('^[[:digit:]\.\' \-]{1,3}$', stripslashes(trim($_POST['pages'])))) { $p = escape_data($_POST['pages']); } else { $p = FALSE; echo '<p>Please enter a number between 1 and 99!</p>'; } if (isset($_POST['design'])) { $d = ($_POST['design']); } else { $d = FALSE; echo '<p>Please select the design you require.</p>'; } // Check for page titles. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*', stripslashes(trim($_POST['titles'])))) { $t = escape_data($_POST['titles']); } else { $t = FALSE; echo '<p>Please enter your titles for each page!</p>'; } // Check for a header colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['header'])))) { $h = escape_data($_POST['header']); } else { $h = FALSE; echo '<p>Please enter a colour for your header section!</p>'; } // Check for a left column colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['left'])))) { $l = escape_data($_POST['left']); } else { $l = '<i>No left column required!</i>'; } // Check for a centre section colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['centre'])))) { $c = escape_data($_POST['centre']); } else { $c = FALSE; echo '<p>Please enter a colour for your centre section!</p>'; } // Check for a right column colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['right'])))) { $r = escape_data($_POST['right']); } else { $r = '<i>No right column required!</i>'; } // Check for a footer colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['footer'])))) { $f = escape_data($_POST['footer']); } else { $f = '<i>No footer section required!</i>'; } // Check for extra auxillary pages. if (isset($_POST['extra'])) { $x = ($_POST['extra']); } else { $x = FALSE; echo '<p>Please choose from one of the options available!</p>'; } // Determine the Price per page. if ($p < 4) { $cost = "£30"; } elseif (4 <= $p && $p < 8) { $cost = "£25"; } elseif ($p >= 8) { $cost = "£22.50"; } $total = ($p * $cost); if ($e && $p && $d && $t && $h && $l && $c && $r && $f && $x && $cost && $total) { $query = "SELECT user_id FROM users WHERE email='$e'"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); if (mysql_num_rows($result) < 1) { echo 'Only members can request this facility, please register with us before requesting a site to be built.'; } else { // Add the request to the database. $query = "INSERT INTO site_request (email, pages, design, titles, header, left, centre, right, footer, extra, cost, total, request_date) VALUES ('$e', '$p', '$d', '$t', '$h', '$l', '$c', '$r', '$f', '$x', '$cost', '$total', 'NOW()' )"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); if (!$result){ echo("Update unsuccessful"); } $subject = "Site Creation Request"; $body = "Thank you for requesting us to build a site for you. Although you have told us that you would like us to create $p pages at a cost of '$'$cost per page, there are still some details we would require from you which we will request in an forthcoming email. The pages will be designed in the $d style, with each page using the titles, $t. The colour scheme for the site will be $h for the header, $l for the left column, $c for the centre, $r for the right column, and $f for the footer. The site will also contain $x supplementary page(s)."; if(!mail($recipient, $subject, $body)){ print 'Your message has not been received, please try contacting us later.'; } $subject = "Site Creation Request"; $body = "A request for a site to be created has been received. The site consists of $p pages, in the $d style, using the following colour scheme: header, $h, left column, $l, centre, $c, right column, $r and footer, $f. $x supplementary page(s) are also required."; $recipient = "my.email.address"; $didit = mail($recipient, $subject, $body); if (!$didit){ echo("Your request has not been received, please try contacting us later"); } else { echo("Thank you for your web site creation request, we will get back to you about further details at $e."); } } // Complete the page. echo ("Thank you for your request to create a web site, an email has been sent to $e with the details you have selected for it, and further developements."); include ("includes/foot.html"); } else { // If it did not run OK. echo '<p>You request could not be processed due to a system error. We apologize for any inconvenience.</p>'; } mysql_close(); // Close the database connection. } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Site Creation Request</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="keywords" content="Home-Groan, Music downloads, MP3 downloads, MP3, Music, MP3 Music downloads, Accident downloads, Accident Music downloads, Accident MP3 downloads, Accident MP3 Music downloads, HG 001, Accident Albums, Home of Accident Recordings, Alley Cat, Brill O'Padd, Alley Cat and Brill O'Padd, Alley Cat and Brill O'Padd Song Writers, Accident Fated to Happen album, Child of War, Dearest Helen, Indian Lament, Sleepless Nights, Graveyard Sign, Help Me Nurze, Harmony in B E D, Glencoe, Remembering, Lambs to the Slaughter, Girl When I Loved You, Pretty Princess, See The City, Symphony of Romance, Dancing Between Silk Sheets, Is This Our Future" /> <link href="error.css" rel="stylesheet" type="text/css"/> </head> <body> <div class="header"> <a href="http://www.home-groan.com/"><img src="members/images/logo2.JPG" alt="Accident Recordings" /></a><p>Site Creation<br />Request Form</p> </div> <div class="leftcolumn"> <a href="members/index.php"><img src="members/images/logo_button.JPG" alt="Home-Groan Home" />Home</a><br /><br /><br /> <a href="members/albums.php"><img src="members/images/logo2_button.JPG" alt="Accident Albums" />Accident Albums</a><br /><br /><br /> <a href="members/screensavers.php"><img src="members/images/screen-saver_button.JPG" alt="Home-Groan Screen Savers" />Screen Savers</a><br /><br /><br /> <a href="http://www.mididrumfiles.com?affnum=1054"><img src="members/images/mididrums.jpg" alt="MIDI Drums" />MIDI Drums</a><br /><br /><br /> <a href="http://www.accidentrecordings.com/contact.php">Contact Us</a> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88"></img></a><br /> <br /> <a href="http://jigsaw.w3.org/css-validator/"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></img> </a> </p> </div> <div class="centre"> <form method="POST" action="site_request.php"> <fieldset> <p><b>Email Address:</b> <input type="text" name="email" size="40" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /></p> <p>How many HTML pages would you require?<br /><b>Number of Pages:</b> <input type="text" name="pages" size="3" maxlength="3" value="<?php if (isset($_POST['pages'])) echo $_POST['pages']; ?>" /> </p> <p>Please choose the design type you require!</p> <p><img src="members/images/page1.JPG" alt="Surround Style" />Surround Style <input type="radio" name="design" value="Surround Style" /></p><br /> <p><img src="members/images/page2.JPG" alt="Alternative Surround Style" />Alternative Surround Style <input type="radio" name="design" value="Alternative Surround Style" /></p><br /> <p><img src="members/images/page3.JPG" alt="3 Rows Style" />3 Rows Style <input type="radio" name="screen_resolution" value="3 Rows Style" /></p><br /> <p><img src="members/images/page4.JPG" alt="Triangle Style" />Triangle Style <input type="radio" name="design" value="Triangle Style" /></p><br /> <p><img src="members/images/page5.JPG" alt="Alternative Triangle Style" />Alternative Triangle Style <input type="radio" name="design" value="Alternative Triangle Style" /></p><br /> <p><img src="members/images/page6.JPG" alt="Left Right Style" />Left Right Style <input type="radio" name="design" value="Left Right Style" /></p><br /> <p><img src="members/images/page7.JPG" alt="Picture Page" />Picture Page <input type="radio" name="design" value="Picture Page" /></p><br /> <p><img src="members/images/page8.JPG" alt="Full Page" />Full Page <input type="radio" name="design" value="Full Page" /></p><br /> <p>Please enter your page titles here, separated by commas.<br /><b>Page Titles:</b> <textarea name="titles" cols="60" rows="5"></textarea></p> <p>Please select the colour you require for each section of your site, you can choose either the colour name or hexadecimal number.<br /></p> <p><b>Header:</b> <input type="text" name="header" size="15" maxlength="15" /></p> <p><b>Left Column:</b> <input type="text" name="left" size="15" maxlength="15" /></p> <p><b>Centre:</b> <input type="text" name="centre" size="15" maxlength="15" /></p> <p><b>Right Column:</b> <input type="text" name="right" size="15" maxlength="15" /></p> <p><b>Footer:</b> <input type="text" name="footer" size="15" maxlength="15" /></p> <p>Do you require a Search or Contact Page?<br /> Contact Page <input type="radio" name="extra" value="contact" /> Search Page <input type="radio" name="extra" value="search" /> Both Pages <input type="radio" name="extra" value="both" /> No Pages <input type="radio" name="extra" value="no" /></p> </fieldset> <p><input type="submit" name="Send" value="Place Request" /> <input type="reset" name="Submit2" value="Amend Request" /></p></form> <div class="footer"> <h5>© www.home-groan.com 2007, designed and built by <a href="http://www.home-groan.com">www.home-groan.com.</a></h5> </div> </body> </html> <?php ob_end_flush(); ?> Code (markup): I was wondering whether it could be something to do with, <p><img src="members/images/page1.JPG" alt="Surround Style" />Surround Style <input type="radio" name="design" value="Surround Style" /></p> <p><img src="members/images/page2.JPG" alt="Alternative Surround Style" />Alternative Surround Style <input type="radio" name="design" value="Alternative Surround Style" /></p> <p><img src="members/images/page3.JPG" alt="3 Rows Style" />3 Rows Style <input type="radio" name="screen_resolution" value="3 Rows Style" /></p> <p><img src="members/images/page4.JPG" alt="Triangle Style" />Triangle Style <input type="radio" name="design" value="Triangle Style" /></p> <p><img src="members/images/page5.JPG" alt="Alternative Triangle Style" />Alternative Triangle Style <input type="radio" name="design" value="Alternative Triangle Style" /></p> <p><img src="members/images/page6.JPG" alt="Left Right Style" />Left Right Style <input type="radio" name="design" value="Left Right Style" /></p> <p><img src="members/images/page7.JPG" alt="Picture Page" />Picture Page <input type="radio" name="design" value="Picture Page" /></p> <p><img src="members/images/page8.JPG" alt="Full Page" />Full Page <input type="radio" name="design" value="Full Page" /></p> Or the following code being for radio buttons. Contact Page <input type="radio" name="extra" value="contact" /> Search Page <input type="radio" name="extra" value="search" /> Both Pages <input type="radio" name="extra" value="both" /> No Pages <input type="radio" name="extra" value="no" /></p> Code (markup):
that error message is very non descriptive at best. If you can, check your error logs and see if there is a more descriptive error then that, php will identify what it had a problem with, you need to find where that is, and have a look.
The error is coming from this else statement in your script } else { // If it did not run OK. echo '<p>You request could not be processed due to a system error. We apologize for any inconvenience.</p>'; } Its hard to trace back where that if/else statement starts with your pasted code. Maybe the very beginning, if (isset($_POST['Send'])) { // Handle the form. stick in an echo statement and see if it outputs if (isset($_POST['Send'])) { echo "You are here"; // Handle the form. if it doesn't output that statement, then there is your problem.
i think i agree with gwkg, try putting in unique echos after your conditional statements to determine the issue. There could also be an issue with error reporting whilist you are buffering php output with the ob_start(); blocks. Comment out the ob_start and ob_get_contents ob_flush commands and see if the error message becomes more understandable. Oh, and if it is a mySQL error try using the or die(mysql_error()); command instead i'm just not sure if the report error function you are using will actually store the data you want. OHHHHH, and another one. Get the script to just echo the SQL statement you were to run. Copy and paste the statement into phpMyAdmin and run it. You will usually get a fairly descriptive or indicitave error from there too.
Your "if" statement on line 99 is evaluating as false: if ($e && $p && $d && $t && $h && $l && $c && $r && $f && $x && $cost && $total) { PHP: so at least one of those variables evaluates to false. To find out which one (or ones) it is, add an echo statement on the next line. Here is your script with that echo added: <?php ob_start(); session_start(); // Include the configuration file for error management and such. require_once ('includes/config.inc.php'); if (isset($_POST['Send'])) { // Handle the form. require_once ('includes/mysql_connect.php'); // Connect to the database. // Check for an email address. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,40}$', stripslashes(trim($_POST['email'])))) { $e = escape_data($_POST['email']); } else { $e = FALSE; echo '<p>Please enter a valid email address!</p>'; } // Check for pages quantity. if (eregi ('^[[:digit:]\.\' \-]{1,3}$', stripslashes(trim($_POST['pages'])))) { $p = escape_data($_POST['pages']); } else { $p = FALSE; echo '<p>Please enter a number between 1 and 99!</p>'; } if (isset($_POST['design'])) { $d = ($_POST['design']); } else { $d = FALSE; echo '<p>Please select the design you require.</p>'; } // Check for page titles. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*', stripslashes(trim($_POST['titles'])))) { $t = escape_data($_POST['titles']); } else { $t = FALSE; echo '<p>Please enter your titles for each page!</p>'; } // Check for a header colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['header'])))) { $h = escape_data($_POST['header']); } else { $h = FALSE; echo '<p>Please enter a colour for your header section!</p>'; } // Check for a left column colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['left'])))) { $l = escape_data($_POST['left']); } else { $l = '<i>No left column required!</i>'; } // Check for a centre section colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['centre'])))) { $c = escape_data($_POST['centre']); } else { $c = FALSE; echo '<p>Please enter a colour for your centre section!</p>'; } // Check for a right column colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['right'])))) { $r = escape_data($_POST['right']); } else { $r = '<i>No right column required!</i>'; } // Check for a footer colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['footer'])))) { $f = escape_data($_POST['footer']); } else { $f = '<i>No footer section required!</i>'; } // Check for extra auxillary pages. if (isset($_POST['extra'])) { $x = ($_POST['extra']); } else { $x = FALSE; echo '<p>Please choose from one of the options available!</p>'; } // Determine the Price per page. if ($p < 4) { $cost = "£30"; } elseif (4 <= $p && $p < 8) { $cost = "£25"; } elseif ($p >= 8) { $cost = "£22.50"; } $total = ($p * $cost); if ($e && $p && $d && $t && $h && $l && $c && $r && $f && $x && $cost && $total) { echo "e='$e' p='$p' d='$d' t='$t' h='$h' l='$l' c='$c' r='$r' f='$f' x='$x' cost='$cost' total='$total'"; $query = "SELECT user_id FROM users WHERE email='$e'"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); if (mysql_num_rows($result) < 1) { echo 'Only members can request this facility, please register with us before requesting a site to be built.'; } else { // Add the request to the database. $query = "INSERT INTO site_request (email, pages, design, titles, header, left, centre, right, footer, extra, cost, total, request_date) VALUES ('$e', '$p', '$d', '$t', '$h', '$l', '$c', '$r', '$f', '$x', '$cost', '$total', 'NOW()' )"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); if (!$result){ echo("Update unsuccessful"); } $subject = "Site Creation Request"; $body = "Thank you for requesting us to build a site for you. Although you have told us that you would like us to create $p pages at a cost of '$'$cost per page, there are still some details we would require from you which we will request in an forthcoming email. The pages will be designed in the $d style, with each page using the titles, $t. The colour scheme for the site will be $h for the header, $l for the left column, $c for the centre, $r for the right column, and $f for the footer. The site will also contain $x supplementary page(s)."; if(!mail($recipient, $subject, $body)){ print 'Your message has not been received, please try contacting us later.'; } $subject = "Site Creation Request"; $body = "A request for a site to be created has been received. The site consists of $p pages, in the $d style, using the following colour scheme: header, $h, left column, $l, centre, $c, right column, $r and footer, $f. $x supplementary page(s) are also required."; $recipient = "my.email.address"; $didit = mail($recipient, $subject, $body); if (!$didit){ echo("Your request has not been received, please try contacting us later"); } else { echo("Thank you for your web site creation request, we will get back to you about further details at $e."); } } // Complete the page. echo ("Thank you for your request to create a web site, an email has been sent to $e with the details you have selected for it, and further developements."); include ("includes/foot.html"); } else { // If it did not run OK. echo '<p>You request could not be processed due to a system error. We apologize for any inconvenience.</p>'; } mysql_close(); // Close the database connection. } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Site Creation Request</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="keywords" content="Home-Groan, Music downloads, MP3 downloads, MP3, Music, MP3 Music downloads, Accident downloads, Accident Music downloads, Accident MP3 downloads, Accident MP3 Music downloads, HG 001, Accident Albums, Home of Accident Recordings, Alley Cat, Brill O'Padd, Alley Cat and Brill O'Padd, Alley Cat and Brill O'Padd Song Writers, Accident Fated to Happen album, Child of War, Dearest Helen, Indian Lament, Sleepless Nights, Graveyard Sign, Help Me Nurze, Harmony in B E D, Glencoe, Remembering, Lambs to the Slaughter, Girl When I Loved You, Pretty Princess, See The City, Symphony of Romance, Dancing Between Silk Sheets, Is This Our Future" /> <link href="error.css" rel="stylesheet" type="text/css"/> </head> <body> <div class="header"> <a href="http://www.home-groan.com/"><img src="members/images/logo2.JPG" alt="Accident Recordings" /></a><p>Site Creation<br />Request Form</p> </div> <div class="leftcolumn"> <a href="members/index.php"><img src="members/images/logo_button.JPG" alt="Home-Groan Home" />Home</a><br /><br /><br /> <a href="members/albums.php"><img src="members/images/logo2_button.JPG" alt="Accident Albums" />Accident Albums</a><br /><br /><br /> <a href="members/screensavers.php"><img src="members/images/screen-saver_button.JPG" alt="Home-Groan Screen Savers" />Screen Savers</a><br /><br /><br /> <a href="http://www.mididrumfiles.com?affnum=1054"><img src="members/images/mididrums.jpg" alt="MIDI Drums" />MIDI Drums</a><br /><br /><br /> <a href="http://www.accidentrecordings.com/contact.php">Contact Us</a> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88"></img></a><br /> <br /> <a href="http://jigsaw.w3.org/css-validator/"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></img> </a> </p> </div> <div class="centre"> <form method="POST" action="site_request.php"> <fieldset> <p><b>Email Address:</b> <input type="text" name="email" size="40" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /></p> <p>How many HTML pages would you require?<br /><b>Number of Pages:</b> <input type="text" name="pages" size="3" maxlength="3" value="<?php if (isset($_POST['pages'])) echo $_POST['pages']; ?>" /> </p> <p>Please choose the design type you require!</p> <p><img src="members/images/page1.JPG" alt="Surround Style" />Surround Style <input type="radio" name="design" value="Surround Style" /></p><br /> <p><img src="members/images/page2.JPG" alt="Alternative Surround Style" />Alternative Surround Style <input type="radio" name="design" value="Alternative Surround Style" /></p><br /> <p><img src="members/images/page3.JPG" alt="3 Rows Style" />3 Rows Style <input type="radio" name="screen_resolution" value="3 Rows Style" /></p><br /> <p><img src="members/images/page4.JPG" alt="Triangle Style" />Triangle Style <input type="radio" name="design" value="Triangle Style" /></p><br /> <p><img src="members/images/page5.JPG" alt="Alternative Triangle Style" />Alternative Triangle Style <input type="radio" name="design" value="Alternative Triangle Style" /></p><br /> <p><img src="members/images/page6.JPG" alt="Left Right Style" />Left Right Style <input type="radio" name="design" value="Left Right Style" /></p><br /> <p><img src="members/images/page7.JPG" alt="Picture Page" />Picture Page <input type="radio" name="design" value="Picture Page" /></p><br /> <p><img src="members/images/page8.JPG" alt="Full Page" />Full Page <input type="radio" name="design" value="Full Page" /></p><br /> <p>Please enter your page titles here, separated by commas.<br /><b>Page Titles:</b> <textarea name="titles" cols="60" rows="5"></textarea></p> <p>Please select the colour you require for each section of your site, you can choose either the colour name or hexadecimal number.<br /></p> <p><b>Header:</b> <input type="text" name="header" size="15" maxlength="15" /></p> <p><b>Left Column:</b> <input type="text" name="left" size="15" maxlength="15" /></p> <p><b>Centre:</b> <input type="text" name="centre" size="15" maxlength="15" /></p> <p><b>Right Column:</b> <input type="text" name="right" size="15" maxlength="15" /></p> <p><b>Footer:</b> <input type="text" name="footer" size="15" maxlength="15" /></p> <p>Do you require a Search or Contact Page?<br /> Contact Page <input type="radio" name="extra" value="contact" /> Search Page <input type="radio" name="extra" value="search" /> Both Pages <input type="radio" name="extra" value="both" /> No Pages <input type="radio" name="extra" value="no" /></p> </fieldset> <p><input type="submit" name="Send" value="Place Request" /> <input type="reset" name="Submit2" value="Amend Request" /></p></form> <div class="footer"> <h5>© www.home-groan.com 2007, designed and built by <a href="http://www.home-groan.com">www.home-groan.com.</a></h5> </div> </body> </html> <?php ob_end_flush(); ?> PHP: Try using that and you will at least know which variable(s) you will need to set in order to avoid the error.
Tried using that method tonight, and I'm afraid not one of the variables printed out, so it looks like there is something fundamentally wrong with my scripting.
Try this: <?php ob_start(); session_start(); // Include the configuration file for error management and such. require_once ('includes/config.inc.php'); if (isset($_POST['Send'])) { // Handle the form. require_once ('includes/mysql_connect.php'); // Connect to the database. // Check for an email address. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,40}$', stripslashes(trim($_POST['email'])))) { $e = escape_data($_POST['email']); } else { $e = FALSE; echo '<p>Please enter a valid email address!</p>'; } // Check for pages quantity. if (eregi ('^[[:digit:]\.\' \-]{1,3}$', stripslashes(trim($_POST['pages'])))) { $p = escape_data($_POST['pages']); } else { $p = FALSE; echo '<p>Please enter a number between 1 and 99!</p>'; } if (isset($_POST['design'])) { $d = ($_POST['design']); } else { $d = FALSE; echo '<p>Please select the design you require.</p>'; } // Check for page titles. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*', stripslashes(trim($_POST['titles'])))) { $t = escape_data($_POST['titles']); } else { $t = FALSE; echo '<p>Please enter your titles for each page!</p>'; } // Check for a header colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['header'])))) { $h = escape_data($_POST['header']); } else { $h = FALSE; echo '<p>Please enter a colour for your header section!</p>'; } // Check for a left column colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['left'])))) { $l = escape_data($_POST['left']); } else { $l = '<i>No left column required!</i>'; } // Check for a centre section colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['centre'])))) { $c = escape_data($_POST['centre']); } else { $c = FALSE; echo '<p>Please enter a colour for your centre section!</p>'; } // Check for a right column colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['right'])))) { $r = escape_data($_POST['right']); } else { $r = '<i>No right column required!</i>'; } // Check for a footer colour. if (eregi ('^[[:alnum:]\.\' \-]{2,15}$', stripslashes(trim($_POST['footer'])))) { $f = escape_data($_POST['footer']); } else { $f = '<i>No footer section required!</i>'; } // Check for extra auxillary pages. if (isset($_POST['extra'])) { $x = ($_POST['extra']); } else { $x = FALSE; echo '<p>Please choose from one of the options available!</p>'; } // Determine the Price per page. if ($p < 4) { $cost = "£30"; } elseif (4 <= $p && $p < 8) { $cost = "£25"; } elseif ($p >= 8) { $cost = "£22.50"; } $total = ($p * $cost); if ($e && $p && $d && $t && $h && $l && $c && $r && $f && $x && $cost && $total) { $query = "SELECT user_id FROM users WHERE email='$e'"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); if (mysql_num_rows($result) < 1) { echo 'Only members can request this facility, please register with us before requesting a site to be built.'; } else { // Add the request to the database. $query = "INSERT INTO site_request (email, pages, design, titles, header, left, centre, right, footer, extra, cost, total, request_date) VALUES ('$e', '$p', '$d', '$t', '$h', '$l', '$c', '$r', '$f', '$x', '$cost', '$total', 'NOW()' )"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); if (!$result){ echo("Update unsuccessful"); } $subject = "Site Creation Request"; $body = "Thank you for requesting us to build a site for you. Although you have told us that you would like us to create $p pages at a cost of '$'$cost per page, there are still some details we would require from you which we will request in an forthcoming email. The pages will be designed in the $d style, with each page using the titles, $t. The colour scheme for the site will be $h for the header, $l for the left column, $c for the centre, $r for the right column, and $f for the footer. The site will also contain $x supplementary page(s)."; if(!mail($recipient, $subject, $body)){ print 'Your message has not been received, please try contacting us later.'; } $subject = "Site Creation Request"; $body = "A request for a site to be created has been received. The site consists of $p pages, in the $d style, using the following colour scheme: header, $h, left column, $l, centre, $c, right column, $r and footer, $f. $x supplementary page(s) are also required."; $recipient = "my.email.address"; $didit = mail($recipient, $subject, $body); if (!$didit){ echo("Your request has not been received, please try contacting us later"); } else { echo("Thank you for your web site creation request, we will get back to you about further details at $e."); } } // Complete the page. echo ("Thank you for your request to create a web site, an email has been sent to $e with the details you have selected for it, and further developements."); include ("includes/foot.html"); } else { // If it did not run OK. echo '<p>You request could not be processed due to a system error. We apologize for any inconvenience.</p>'; echo "<p>e='$e' p='$p' d='$d' t='$t' h='$h' l='$l' c='$c' r='$r' f='$f' x='$x' cost='$cost' total='$total'</p>"; } mysql_close(); // Close the database connection. } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Site Creation Request</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="keywords" content="Home-Groan, Music downloads, MP3 downloads, MP3, Music, MP3 Music downloads, Accident downloads, Accident Music downloads, Accident MP3 downloads, Accident MP3 Music downloads, HG 001, Accident Albums, Home of Accident Recordings, Alley Cat, Brill O'Padd, Alley Cat and Brill O'Padd, Alley Cat and Brill O'Padd Song Writers, Accident Fated to Happen album, Child of War, Dearest Helen, Indian Lament, Sleepless Nights, Graveyard Sign, Help Me Nurze, Harmony in B E D, Glencoe, Remembering, Lambs to the Slaughter, Girl When I Loved You, Pretty Princess, See The City, Symphony of Romance, Dancing Between Silk Sheets, Is This Our Future" /> <link href="error.css" rel="stylesheet" type="text/css"/> </head> <body> <div class="header"> <a href="http://www.home-groan.com/"><img src="members/images/logo2.JPG" alt="Accident Recordings" /></a><p>Site Creation<br />Request Form</p> </div> <div class="leftcolumn"> <a href="members/index.php"><img src="members/images/logo_button.JPG" alt="Home-Groan Home" />Home</a><br /><br /><br /> <a href="members/albums.php"><img src="members/images/logo2_button.JPG" alt="Accident Albums" />Accident Albums</a><br /><br /><br /> <a href="members/screensavers.php"><img src="members/images/screen-saver_button.JPG" alt="Home-Groan Screen Savers" />Screen Savers</a><br /><br /><br /> <a href="http://www.mididrumfiles.com?affnum=1054"><img src="members/images/mididrums.jpg" alt="MIDI Drums" />MIDI Drums</a><br /><br /><br /> <a href="http://www.accidentrecordings.com/contact.php">Contact Us</a> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88"></img></a><br /> <br /> <a href="http://jigsaw.w3.org/css-validator/"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></img> </a> </p> </div> <div class="centre"> <form method="POST" action="site_request.php"> <fieldset> <p><b>Email Address:</b> <input type="text" name="email" size="40" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /></p> <p>How many HTML pages would you require?<br /><b>Number of Pages:</b> <input type="text" name="pages" size="3" maxlength="3" value="<?php if (isset($_POST['pages'])) echo $_POST['pages']; ?>" /> </p> <p>Please choose the design type you require!</p> <p><img src="members/images/page1.JPG" alt="Surround Style" />Surround Style <input type="radio" name="design" value="Surround Style" /></p><br /> <p><img src="members/images/page2.JPG" alt="Alternative Surround Style" />Alternative Surround Style <input type="radio" name="design" value="Alternative Surround Style" /></p><br /> <p><img src="members/images/page3.JPG" alt="3 Rows Style" />3 Rows Style <input type="radio" name="screen_resolution" value="3 Rows Style" /></p><br /> <p><img src="members/images/page4.JPG" alt="Triangle Style" />Triangle Style <input type="radio" name="design" value="Triangle Style" /></p><br /> <p><img src="members/images/page5.JPG" alt="Alternative Triangle Style" />Alternative Triangle Style <input type="radio" name="design" value="Alternative Triangle Style" /></p><br /> <p><img src="members/images/page6.JPG" alt="Left Right Style" />Left Right Style <input type="radio" name="design" value="Left Right Style" /></p><br /> <p><img src="members/images/page7.JPG" alt="Picture Page" />Picture Page <input type="radio" name="design" value="Picture Page" /></p><br /> <p><img src="members/images/page8.JPG" alt="Full Page" />Full Page <input type="radio" name="design" value="Full Page" /></p><br /> <p>Please enter your page titles here, separated by commas.<br /><b>Page Titles:</b> <textarea name="titles" cols="60" rows="5"></textarea></p> <p>Please select the colour you require for each section of your site, you can choose either the colour name or hexadecimal number.<br /></p> <p><b>Header:</b> <input type="text" name="header" size="15" maxlength="15" /></p> <p><b>Left Column:</b> <input type="text" name="left" size="15" maxlength="15" /></p> <p><b>Centre:</b> <input type="text" name="centre" size="15" maxlength="15" /></p> <p><b>Right Column:</b> <input type="text" name="right" size="15" maxlength="15" /></p> <p><b>Footer:</b> <input type="text" name="footer" size="15" maxlength="15" /></p> <p>Do you require a Search or Contact Page?<br /> Contact Page <input type="radio" name="extra" value="contact" /> Search Page <input type="radio" name="extra" value="search" /> Both Pages <input type="radio" name="extra" value="both" /> No Pages <input type="radio" name="extra" value="no" /></p> </fieldset> <p><input type="submit" name="Send" value="Place Request" /> <input type="reset" name="Submit2" value="Amend Request" /></p></form> <div class="footer"> <h5>© www.home-groan.com 2007, designed and built by <a href="http://www.home-groan.com">www.home-groan.com.</a></h5> </div> </body> </html> <?php ob_end_flush(); ?> PHP: It will echo the variables immediately after the error you receive.
I managed to resolve one of the parts that prevented my script even from letting me know that it had an error, I found that I had used the code } elseif ($p <= 4 && $p < 8) { whereas I should have used the > sign not 2 < signs. I also now am using the global variables in the same section. Having said that, I am still getting error messages about my sql when I submit the form, and these are the errors I am getting. "An error occured in script '/home/accident/public_html/site_request.php' on line 113: " Query: INSERT into site_request (email, pages, design, titles, header, left, centre, right, footer, extra, cost, total, request_date) VALUES ('myemail@address.com', '6', 'Surround Style', 'index, album1, album2, album3, album4, album5', 'Red', 'Green', 'White', 'No right column required!', 'Blue', 'both', '25', '150', NOW() ) Code (markup): And this is the code for the page. // Check for a header colour. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*', stripslashes(trim($_POST['header'])))) { $h = escape_data($_POST['header']); } else { $h = FALSE; echo '<p>Please enter a colour for your header section!</p>'; } // Check for a left column colour. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*', stripslashes(trim($_POST['left'])))) { $l = escape_data($_POST['left']); } else { $l = '<i>No left column required!</i>'; } // Check for a centre section colour. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*', stripslashes(trim($_POST['centre'])))) { $c = escape_data($_POST['centre']); } else { $c = FALSE; echo '<p>Please enter a colour for your centre section!</p>'; } // Check for a right column colour. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*', stripslashes(trim($_POST['right'])))) { $r = escape_data($_POST['right']); } else { $r = '<i>No right column required!</i>'; } // Check for a footer colour. if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*', stripslashes(trim($_POST['footer'])))) { $f = escape_data($_POST['footer']); } else { $f = '<i>No footer section required!</i>'; } $query = "INSERT into site_request (email, pages, design, titles, header, left, centre, right, footer, extra, cost, total, request_date) VALUES ('$e', '$p', '$d', '$t', '$h', '$l', '$c', '$r', '$f', '$x', '$cost', '$total', NOW() )"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); Code (markup): These are the settings of the sections on the form itself. <p><b>Header:</b> <input type="text" name="header" size="15" maxlength="30" /></p> <p><b>Left Column:</b> <input type="text" name="left" size="15" maxlength="32" /></p> <p><b>Centre:</b> <input type="text" name="centre" size="15" maxlength="30" /></p> <p><b>Right Column:</b> <input type="text" name="right" size="15" maxlength="32" /></p> <p><b>Footer:</b> <input type="text" name="footer" size="15" maxlength="32" /></p> Code (markup): If anyone can help I would be very grateful.