Jump to content

handling the .get[id] in a form


jeff5656

Recommended Posts

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");
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.