jeff5656 Posted December 12, 2008 Share Posted December 12, 2008 I have the following form that a user gets to by clicking a patient name. When they submit it, I want the form to process and then bring user BACK to this form. However, when I do this, I lose the get[id] info. How do I modify these files so the patient that the user originally clicked is "remembered": Form: $consultsq1 = "SELECT * FROM icu WHERE id_incr = '" . $_GET['id'] . "'"; $result = mysql_query ($consultsq1) or die ("Invalid query: " . mysql_error ()); $row = mysql_fetch_array ($result); $id_incr = $row['id_incr']; ?> <form name="newsubmit" method="post" action="addbill.php"> Diagnosis 1<input name="dx1" type="text" size="20" /> <input type="hidden" name ="id_incr" value="<?php echo $id_incr; ?>"/> <input type="submit" value="Add" onClick="return check('newsubmit', this.name)"/> </form> Action file (addbill.php): <?php include ("connectdb.php"); // grab the variables from the form $pt_id = $_POST['id_incr']; //$billing_datepre = $_POST['billing_date']; $newdate = date("Y-m-d", strtotime($_POST['rcf_date'])); $billing_lvl = $_POST['billing_lvl']; $dx1 = $_POST['dx1']; $dx2 = $_POST['dx2']; $dx3 = $_POST['dx3']; $dx4 = $_POST['dx4']; $dx5 = $_POST['dx5']; $dx6 = $_POST['dx6']; $dx7 = $_POST['dx7']; $dx8 = $_POST['dx8']; $staff = $_POST['staff']; $query = "INSERT INTO dos (dos_id, pt_id, billing_date, billing_lvl, dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, staff) VALUES('', '$pt_id', '$newdate', '$billing_lvl', '$dx1', '$dx2', '$dx3', '$dx4', '$dx5', '$dx6', '$dx7', '$dx8', '$staff' )"; mysql_query($query) or die(mysql_error()); header("Location: editdos.php"); ?> Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 12, 2008 Share Posted December 12, 2008 Simple, don't use header(). Instead, use an include(). Quote Link to comment Share on other sites More sharing options...
rhodesa Posted December 12, 2008 Share Posted December 12, 2008 in the action file, $pt_id is the patient id right? so just finish that file with: mysql_query($query) or die(mysql_error()); header("Location: editdos.php?id=".$pt_id); ?> Quote Link to comment 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.