lansing
03-06-2006, 12:20 AM
I have a drop down menu that has 3 options..Received, Pending, Filled, & Canceled. I am saving this a db when the user clicks the "save" button. Currently it saves it & does nothing else. I need this to happen.
If the user selects the status of Filled I need to be able to enter a confirmation number & a tracking number & then the save to the db will take place. If the user selects the status of Canceled then enter a reason why it was canceled...kind of like comments of why it was canceled. If they just choose the option Received or Pending then it just saves the status as I currently have it written.
This is my file now...<html>
<head>
<?php require("../vars.php"); ?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo "$pop_status" ?></title>
</head>
<body>
<form method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
<fieldset>
<legend> Update Order Status </legend>
<p align="center">
<label for="status">Status:<select name="status" id="status">
<option selected value="">Choose status...
<option value="Received">Received</option>
<option value="Pending">Pending</option>
<option value="Filled">Filled</option>
<option value="Canceled">Canceled</option>
</select></label><br /><br>
<input type="submit" value="Save" name="save" class="submit" />
</fieldset>
</form>
<?php
if(isset($_POST['save']))
{
require("../cdb.php");
$status = $_POST['status'];
$now = date("Y-m-d H:i:s");
$id = $_REQUEST['id'];
$status_update = ("UPDATE orders SET order_status = '$status', order_modified = '$now' WHERE order_id = '$id'");
$sqlquery = mysql_query($status_update) or die(mysql_error());
if(!$sqlquery)
{
echo 'Error in updating the Order Status';
}
else
{
echo 'Order Status successfully updated!';
}
}
?>
<p align="left"><?=$popup_close_text;?></p>
</body>
</html>
If the user selects the status of Filled I need to be able to enter a confirmation number & a tracking number & then the save to the db will take place. If the user selects the status of Canceled then enter a reason why it was canceled...kind of like comments of why it was canceled. If they just choose the option Received or Pending then it just saves the status as I currently have it written.
This is my file now...<html>
<head>
<?php require("../vars.php"); ?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo "$pop_status" ?></title>
</head>
<body>
<form method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
<fieldset>
<legend> Update Order Status </legend>
<p align="center">
<label for="status">Status:<select name="status" id="status">
<option selected value="">Choose status...
<option value="Received">Received</option>
<option value="Pending">Pending</option>
<option value="Filled">Filled</option>
<option value="Canceled">Canceled</option>
</select></label><br /><br>
<input type="submit" value="Save" name="save" class="submit" />
</fieldset>
</form>
<?php
if(isset($_POST['save']))
{
require("../cdb.php");
$status = $_POST['status'];
$now = date("Y-m-d H:i:s");
$id = $_REQUEST['id'];
$status_update = ("UPDATE orders SET order_status = '$status', order_modified = '$now' WHERE order_id = '$id'");
$sqlquery = mysql_query($status_update) or die(mysql_error());
if(!$sqlquery)
{
echo 'Error in updating the Order Status';
}
else
{
echo 'Order Status successfully updated!';
}
}
?>
<p align="left"><?=$popup_close_text;?></p>
</body>
</html>