JimChuD Posted May 26, 2006 Share Posted May 26, 2006 Hey,I have stumbled upon something i have never experienced before.When creating an input function i found an issue of when the input was created it then put in the variables in to the new record but about 5 seconds later it created a blank entry below it containing no information at all.I seperated the Input from the function in to its own script and found there was still a problem with it and it still occured.i stripped down the input query and regardless of how many of the fields i tried to insert and regardless of them being variables or hard coded results it still created the duplicate record.The last thing i did was to remove the session_start(); and this instantly resolved the issues. i rebuilt the query and it still worked fine obviously without the users name.i have coded inputs which use session variables before and have never came across anything like this... any help would be greatly appreciated..RegardsJim [code]<?session_start();echo " <html> <head> <title>Job Documentation - New Job</title> <Link rel=\"stylesheet\" href=\"styles/style.css\"> </head> <body>";include('styles/style.php');if ($_GET['status'] == 'insert_job_confirm') { db_connect(); $name = addslashes($_POST['name']); $priority = $_POST['priority']; $frequency = $_POST['frequency']; $frequency_note = addslashes($_POST['frequency_note']); $runs_in = $_POST['runs_in']; $description = addslashes($_POST['description']); $application = $_POST['application']; $instructions = addslashes($_POST['instructions']); #$username = $_SESSION['user']; $query_insert_job = "INSERT INTO job (name, priority, frequency, frequency_note, runs_in, description, application, instructions, date_created) VALUES ('{$name}', '{$priority}', '{$frequency}', '{$frequency_note}', '{$runs_in}', '{$description}', '{$application}', '{$instructions}', now())"; $result_insert_job = mysql_query($query_insert_job); } else { db_connect(); /* PRIORITY SEARCH TO GET ALL PRIORITIES */ $query_priority = "SELECT priority.id, priority.priority FROM priority ORDER BY priority.priority ASC"; $result_priority = mysql_query($query_priority); /* FREQUENCY SEARCH FOR ALL FREQUENCIES */ $query_frequency = "SELECT frequency.id, frequency.frequency FROM frequency ORDER BY frequency.frequency ASC"; $result_frequency = mysql_query($query_frequency); /* RUNS_IN SEARCH FOR ALL RUNS_IN */ $query_runs_in = "SELECT runs_in.id, runs_in.runs_in FROM runs_in ORDER BY runs_in.runs_in ASC"; $result_runs_in = mysql_query($query_runs_in); /* APPLICATION SEARCH TO GET ALL APPLICATIONS */ $query_application = "SELECT application.id, application.application FROM application ORDER BY application.application ASC"; $result_application = mysql_query($query_application); echo ' <b>New Job Creation</b>'; echo " <form method=\"POST\" action=\"{$_SERVER['PHP_SELF']}?status=insert_job_confirm&jobid=load\">"; echo " <table> <tr> <td> <b>Name:</b> </td> <td> <input name=\"name\" value=\"\"> </td> </tr> <tr> <td> <b>Priority:</b> </td> <td> <select name=\"priority\">"; while ($priority = mysql_fetch_array($result_priority)) { echo " <option value=\"{$priority['id']}\">{$priority['priority']}</option>"; } echo " </td> </tr> <tr> <td> <b>Frequency:</b> </td> <td> <select name=\"frequency\">"; while ($frequency = mysql_fetch_array($result_frequency)) { echo " <option value=\"{$frequency['id']}\">{$frequency['frequency']}</option>"; } echo " </td> </tr> <tr> <td> <b>Frequency Note:</b> </td> <td> <input name=\"frequency_note\" value=\"\"> </td> </tr> <tr> <td> <b>Runs In:</b> </td> <td> <select name=\"runs_in\">"; while ($runs_in = mysql_fetch_array($result_runs_in)) { echo " <option value=\"{$runs_in['id']}\">{$runs_in['runs_in']}</option>"; } echo " </td> </tr> <tr> <td> <b>Description:</b> </td> <td> <input name=\"description\" value=\"\"> </td> </tr> <tr> <td> <b>Application:</b> </td> <td> <select name=\"application\">"; while ($application = mysql_fetch_array($result_application)) { echo " <option value=\"{$application['id']}\">{$application['application']}</option>"; } echo " </td> </tr> <tr> <td> <br> <b>Instructions:</b> </td> </tr> <tr> <td colspan=2> <textarea name=\"instructions\" cols=\"50\" rows=\"7\"></textarea> </td> </tr> <tr> <td colspan=\"2\"> <input type=\"submit\" name=\"Submit\" value=\"Submit\"> </td> </tr> </table> </form> ";} ?> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/10492-sessions-creating-multiple-inputs-on-sql-query/ 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.