joline Posted May 22, 2008 Share Posted May 22, 2008 Hi! I have an html form that calls a page which updates a database with the form data. That same page has an include line in it. Through an awful lot of time spent removing each line from the page and trying it one step at a time, I've figured out that the page works perfectly if the include statement is removed. If the include statement is there, the data is not updated. Below is an abbreviated version of the code. If anyone has any suggestions, I could really use it. I can't figure out why the include statement would effect the update statement. Thanks, Joline <html> <form name = "Training" method ="POST" action ="TrainingQuestions.php"> //form stuff here </form> </html> TrainingQuestions.php <?php session_start(); if(isset($_SESSION["theid"])) { //this is on every page - it is just making sure the user is registered. $user_id = $_SESSION["theid"]; include ('***_config.php'); //this is my database config file - it works fine on other pages. $design = addslashes(trim($_POST['design'])); //(rest of the vars here) $start_value = addslashes(trim($_POST['start_value'])); $query=("UPDATE Interview_Answers SET design = '$design', what = '$what', whent = '$whent', barriers = '$barriers', barriersc = '$barriersc', discussion = '$discussion', nature = '$nature'WHERE user_id = '$user_id'"); $result =mysql_query($query); if ($start_value == "PI") { include ("PI_FeedbackQuestions.html"); } if ($start_value == "NSF") { include ("NSF_FeedbackQuestions.html"); } if ($start_value == "SPA") { include ("SPA_FeedbackQuestions.html"); } } else { global $message; $message = "Wrong user name or password. Please try again!"; include ('Home.html'); } ?> Link to comment https://forums.phpfreaks.com/topic/106838-mysql-updatephp-include/ Share on other sites More sharing options...
jonsjava Posted May 22, 2008 Share Posted May 22, 2008 are you overwriting an important variable with a same-named variable in the include file? Link to comment https://forums.phpfreaks.com/topic/106838-mysql-updatephp-include/#findComment-547741 Share on other sites More sharing options...
joline Posted May 23, 2008 Author Share Posted May 23, 2008 Thanks for the suggestion. I thought that could have been the case, so I went through and made sure that all the variables had different names, and I'm still getting the same problem. Thanks again, Joline Link to comment https://forums.phpfreaks.com/topic/106838-mysql-updatephp-include/#findComment-548080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.