Hi All,
Still on with my cart script, which is near completion now. However, I've got a problem with one form which doesn't seem to be compatible in Internet Explorer, yet when used in Firefox - the form works fine!!!
What I'm trying to do is to view the order details, then if the status of the order has changed to select a value from a drop down list which when the person clicks modify will alter the value within the database entry.
Relevent bits of code are:
detail.php
<?
//Create Drop Down List
$orderStatus = array('New', 'Paid', 'Shipped', 'Completed', 'Cancelled');
$orderOption = '';
foreach ($orderStatus as $status) {
$orderOption .= "<option value='$status'">$status</option> \r \n";
}
?>
<form action="processOrder.php" method="post" name="frmOrder" id="frmOrder">
Last Update: <?php echo $od_last_update; ?><br>
Status:
<select name="cboOrderStatus" id="cboOrderStatus" class="box">
<?php echo $orderOption; ?> </select>
<input name="btnModify" type="button" id="btnModify" value="Modify Status" class="box" onClick="modifyOrderStatus(<?php echo $orderId; ?>);"></form>
processOrder.php
<?
function modifyOrder()
{
if (!isset($_GET['oid']) || (int)$_GET['oid'] <= 0
|| !isset($_GET['status']) || $_GET['status'] == '') {
header('Location: index.php');
}
$orderId = (int)$_GET['oid'];
$status = $_GET['status'];
$sql = "UPDATE tbl_order
SET od_status='$status',od_last_update = NOW()
WHERE od_id = $orderId";
$result = dbQuery($sql);
header("Location: index.php?view=list&status=$status");
}
?>
order.js
function viewOrder()
{
statusList = window.document.frmOrderList.cboOrderStatus;
status = statusList.options[statusList.selectedIndex].value;
if (status != '') {
window.location.href = 'index.php?status=' + status;
} else {
window.location.href = 'index.php';
}
}
function modifyOrderStatus(orderId)
{
statusList = window.document.frmOrder.cboOrderStatus;
status = statusList.options[statusList.selectedIndex].value;
window.location.href = 'processOrder.php?action=modify&oid=' + orderId + '&status=' + status;
}
function deleteOrder(orderId)
{
}
I've omitted a lot of the code in detail.php because its all irrelevant.
The code works only in Firefox, but doesnt work in Internet Explorer. However, in Internet Explorer it shows the Last Update time as correct so I know this bit works, but for some reason the script wont change the order status.
Any ideas anyone?