jeff5656 Posted December 22, 2008 Share Posted December 22, 2008 When a user click this: <a href="billing/editdos.php?action=edit&id=<?php echo $row['id_incr']; ?>"> Billing</a> They go to the page below called editdos.php. I put a <form> with name dx1, on this that I want it to reload editdos.php. The POSTed variable works, BUT the GET[id] info is lost so record doesn't get queried anymore. How do I correct this? I think the answer lies in what I put in the hidden form variable, but then I don't know how to deal with case, and the GET (because the <a href link no longer applies). Hope this isn't too confusing! include "connectdb.php"; switch ($_GET['action']) { case "edit": $consultsq1 = "SELECT * FROM icu INNER JOIN dos ON icu.id_incr = dos.pt_id AND icu.id_incr = '" . $_GET['id'] . "' order by dos.billing_date"; $result = mysql_query ($consultsq1) or die ("Invalid query: " . mysql_error ()); for($n=0;$row = mysql_fetch_assoc ($result);$n++) { if(!$n){ echo "<div align='center'><h3>Billing data for: " . $row['patient'] . " MRN: " . $row['mrn'] . "</h3></div>"; echo "<u>ICU Admit Date</u>: " . date('m/d/Y', strtotime($row['rcf_date2'])); echo "<table><tr><th>Date</th><th>Level</th><th>Diagnoses</th></tr>"; } echo "<tr><td bgcolor='FFFFFF'>"; ?><a href="editbill.php?action=edit&id=<?php echo $row['dos_id']; ?>"><?php echo date('m/d/Y', strtotime($row['billing_date'])); ?></a> <?php echo "</td><td bgcolor='FFFFFF'>" . $row['billing_lvl'] . "</td><td bgcolor='FFFFFF'>"; echo "<table ><td bgcolor='FFFFFF'>";?> <form name="dx1" method="post" action="editdos.php"><input type="hidden" name ="dx1" value="<?php echo $row['dx1']; ?>"/> <input type="hidden" name ="dos_id" value="<?php echo $row['dos_id']; ?>"/> <input type="hidden" name ="pt_id" value="<?php echo $row['pt_id']; ?>"/> <input type="submit" value="<?php echo $row['dx1']; ?>" /> </form> Link to comment https://forums.phpfreaks.com/topic/138051-solved-submitting-a-form-to-same-page-that-expects-get/ Share on other sites More sharing options...
ngreenwood6 Posted December 22, 2008 Share Posted December 22, 2008 I think if I read this correctly that you need to put the id in the url again with the form, a quick example would be: <form name="dx1" method="post" action="editdos.php?action=edit&id=<?php echo $id; ?>"> Of course when you start the page you would have to get the id. Hopefully that makes sense. Link to comment https://forums.phpfreaks.com/topic/138051-solved-submitting-a-form-to-same-page-that-expects-get/#findComment-721603 Share on other sites More sharing options...
mattjones Posted December 22, 2008 Share Posted December 22, 2008 Use a $_session variable to store the $_get variable and you can call it again whenever you need it. $_SESSION['id'] = $_GET['id'] Link to comment https://forums.phpfreaks.com/topic/138051-solved-submitting-a-form-to-same-page-that-expects-get/#findComment-721610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.