chriscloyd Posted December 14, 2006 Share Posted December 14, 2006 okay heres my problem its not inserting info into my database and its not sending me to any other pageheres my code can someone help me[code]<?phpmysql_connect('localhost','*************','*************');mysql_select_db('***********');$first = $_POST['first'];$last = $_POST['last'];$phone = $_POST['phone'];$email = $_POST['email'];$company = $_POST['company'];$url = $_POST['url'];$title = $_POST['title'];$wd = $_POST['wd'];$fd = $_POST['fd'];$ad = $_POST['ad'];$other = $_POST['other'];$other2 = $_POST['other2'];$description = nl2br($_POST['description']);$date = $_POST['date'];$refered = $_POST['refered'];$referedd = mysql_query("SELECT * FROM users WHERE id = '$refered'") ;$r = mysql_fetch_assoc($referedd);$remail = $r['email'];$rfirst = $r['first'];$rlast = $r['last'];$rname = $rfirst.' '.$rlast;//check required fieldsif (!$first) { $error = "You did not enter your first name.<br />"; header("Location: ../index.php?error=$error");} elseif (!$last) { $error = "You did not enter your last name.<br />"; header("Location: ../index.php?error=$error");} elseif (!ereg("^[0-9]{3}-[0-9]{3}-[0-9]{4}$", $phone)) { $error = "You did not enter a valid phone number.<br />"; header("Location: ../index.php?error=$error");} elseif (!$phone) { $error = "You did not enter a phone number.<br />"; header("Location: ../index.php?error=$error");} elseif (!$wd) { $wd = "Dont need";} elseif (!$fd) { $wd = "Dont need";} elseif (!$ad) { $wd = "Dont need";} elseif ($other) { $other = $other2;} else { $description = nl2br($description); $create_quote = mysql_query("INSERT INTO quotes (`first`,`last`,`phone`,`email`,`company`,`url`,`title`,`wd`,`fd`,`ad`,`other`,`other2`,`description`,`date`,`refered`) VALUES ('$first','$last','$phone','$email','$company','$url','$title','$wd','$fd','$ad','$other','$other2','$description','$date','$rname')") or die(mysql_error()); if (!$create_quote) { $error = "The quote could not be sent at<br /> this moment please try again.<br />"; header("Location: ../index.php?error=$error"); } else { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: Kyle Lipkin <[email protected]>' . "\r\n"; $headers .= 'From: Quote Management Script <[email protected]>' . "\r\n"; if(isset($_POST['refered'])){ $headers .= 'BBC: '.$rfirst.' '.$rlast.' <'.$remail.'>' . "\r\n"; } $body = '<style type="text/css"><!--body,td,th {font-family: Verdana;font-size: 12px;}--></style><img src="http://www.srxstudios.com/pm/images/image1.jpg" width="500" height="60"><br><br /><br /><br><br><br>' . $first .' '. $last . ' requested a quote,<br /><br /><strong>Refered by:</strong> '.$rfirst.' '.$rlast.'<br /><br><strong>User Information-</strong><br /><br /><strong>First Name:</strong> '.$first.'<br /><strong>Last Name:</strong> '.$last.'<br /><strong>First Name:</strong> '.$phone.'<br /><strong>First Name:</strong> '.$email.'<br /><br><strong>Company Info-</strong><br><br><strong>Company Name:</strong> '.$company.'<br /><strong>URL:</strong> '.$url.'<br /><strong>Title:</strong> '.$title.'<br /><br><strong>Quote Information-</strong><br><br><strong>Web Design:</strong> '.$wd.'<br /><strong>Branding / Logo:</strong> '.$fd.'<br /><strong>Application Design:</strong> '.$ad.'<br /><strong>Other:</strong> '.$other.'<br /><strong>Description:</strong> '.$description.'<br><br /><br /><br><br><br><strong>Quote Management System</strong><BR>. . . . . . . . . . . . . . . . . . . . . . . . . . .<BR><strong>SRX Studios, LLC.</strong><strong><BR><a href="http://www.srxstudios.com/">http://www.srxstudios.com</a><BR>'; $mail = mail($email,"Quote Sent ".$date."",$body,$headers); if($mail) { header("Location: ../index2.php?page=quote_sent"); } else { header("Location: ../index2.php?page=quote_not_sent"); } }}?>[/code] Link to comment https://forums.phpfreaks.com/topic/30618-quote-script-help/ Share on other sites More sharing options...
trq Posted December 14, 2006 Share Posted December 14, 2006 Try some debuging, example...[code=php:0]$result = mysql_query($sql) or dir(mysql_erorr());[/code] Link to comment https://forums.phpfreaks.com/topic/30618-quote-script-help/#findComment-141005 Share on other sites More sharing options...
chriscloyd Posted December 14, 2006 Author Share Posted December 14, 2006 still it just stays on the page Link to comment https://forums.phpfreaks.com/topic/30618-quote-script-help/#findComment-141009 Share on other sites More sharing options...
chriscloyd Posted December 14, 2006 Author Share Posted December 14, 2006 heres my new code with debugging[CODE]<?phpmysql_connect('localhost','*********','***********');mysql_select_db('***************');$first = $_POST['first'];$last = $_POST['last'];$phone = $_POST['phone'];$email = $_POST['email'];$company = $_POST['company'];$url = $_POST['url'];$title = $_POST['title'];$wd = $_POST['wd'];$fd = $_POST['fd'];$ad = $_POST['ad'];$other = $_POST['other'];$other2 = $_POST['other2'];$description = nl2br($_POST['description']);$date = $_POST['date'];$refered = $_POST['refered'];$referedd = "SELECT * FROM users WHERE id = '$refered'";$results = mysql_query($referedd) or die(mysql_error());$r = mysql_fetch_assoc($results );$remail = $r['email'];$rfirst = $r['first'];$rlast = $r['last'];$rname = $rfirst.' '.$rlast;//check required fieldsif (!$first) { $error = "You did not enter your first name.<br />"; header("Location: ../index.php?error=$error");} elseif (!$last) { $error = "You did not enter your last name.<br />"; header("Location: ../index.php?error=$error");} elseif (!ereg("^[0-9]{3}-[0-9]{3}-[0-9]{4}$", $phone)) { $error = "You did not enter a valid phone number.<br />"; header("Location: ../index.php?error=$error");} elseif (!$phone) { $error = "You did not enter a phone number.<br />"; header("Location: ../index.php?error=$error");} elseif (!$wd) { $wd = "Dont need";} elseif (!$fd) { $wd = "Dont need";} elseif (!$ad) { $wd = "Dont need";} elseif ($other) { $other = $other2;} else { $description = nl2br($description); $create_quote = "INSERT INTO quotes (`first`,`last`,`phone`,`email`,`company`,`url`,`title`,`wd`,`fd`,`ad`,`other`,`other2`,`description`,`date`,`refered`) VALUES ('$first','$last','$phone','$email','$company','$url','$title','$wd','$fd','$ad','$other','$other2','$description','$date','$rname')"; $result = mysql_query($create_quote) or die(mysql_error()); if (!$result) { $error = "The quote could not be sent at<br /> this moment please try again.<br />"; header("Location: ../index.php?error=$error"); } else { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: Kyle Lipkin <[email protected]>' . "\r\n"; $headers .= 'From: Quote Management Script <[email protected]>' . "\r\n"; if(isset($_POST['refered'])){ $headers .= 'BBC: '.$rfirst.' '.$rlast.' <'.$remail.'>' . "\r\n"; } $body = '<style type="text/css"><!--body,td,th {font-family: Verdana;font-size: 12px;}--></style><img src="http://www.srxstudios.com/pm/images/image1.jpg" width="500" height="60"><br><br /><br /><br><br><br>' . $first .' '. $last . ' requested a quote,<br /><br /><strong>Refered by:</strong> '.$rfirst.' '.$rlast.'<br /><br><strong>User Information-</strong><br /><br /><strong>First Name:</strong> '.$first.'<br /><strong>Last Name:</strong> '.$last.'<br /><strong>First Name:</strong> '.$phone.'<br /><strong>First Name:</strong> '.$email.'<br /><br><strong>Company Info-</strong><br><br><strong>Company Name:</strong> '.$company.'<br /><strong>URL:</strong> '.$url.'<br /><strong>Title:</strong> '.$title.'<br /><br><strong>Quote Information-</strong><br><br><strong>Web Design:</strong> '.$wd.'<br /><strong>Branding / Logo:</strong> '.$fd.'<br /><strong>Application Design:</strong> '.$ad.'<br /><strong>Other:</strong> '.$other.'<br /><strong>Description:</strong> '.$description.'<br><br /><br /><br><br><br><strong>Quote Management System</strong><BR>. . . . . . . . . . . . . . . . . . . . . . . . . . .<BR><strong>SRX Studios, LLC.</strong><strong><BR><a href="http://www.srxstudios.com/">http://www.srxstudios.com</a><BR>'; $mail = mail($email,"Quote Sent ".$date."",$body,$headers); if($mail) { header("Location: ../index2.php?page=quote_sent"); } else { header("Location: ../index2.php?page=quote_not_sent"); } }}?>[/CODE] Link to comment https://forums.phpfreaks.com/topic/30618-quote-script-help/#findComment-141010 Share on other sites More sharing options...
trq Posted December 14, 2006 Share Posted December 14, 2006 You keep missing out a ' from around the username field of mysql_connect(), I assume thats just in your post and not in your actaul code.If the debugging isn't producing errors it look like you might have errors switched off, put this at the top of your page.[code=php:0]error_reporting(E_ALL);[/code] Link to comment https://forums.phpfreaks.com/topic/30618-quote-script-help/#findComment-141014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.