Hi Eric
Here is my code below for the Update page:
// in the head section:
<?php require_once('Connections/connDiamond.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "UpdExch")) {
$updateSQL = sprintf("UPDATE linedetails SET CustomerID=%s, Quantity1=%s, Usage
=%s, ISDN2=%s, LineProvider=%s WHERE Exchange=%s",
GetSQLValueString($HTTP_POST_VARS['hiddenField'], "int"),
GetSQLValueString($HTTP_POST_VARS['qty'], "int"),
GetSQLValueString($HTTP_POST_VARS['usage'], "text"),
GetSQLValueString($HTTP_POST_VARS['isdn2'], "int"),
GetSQLValueString($HTTP_POST_VARS['lineprov'], "text"),
GetSQLValueString($HTTP_POST_VARS['exchange'], "text"));
mysql_select_db($database_connDiamond, $connDiamond);
$Result1 = mysql_query($updateSQL, $connDiamond) or die(mysql_error());
$updateGoTo = "installs.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_RSexhchange = "1";
if (isset($HTTP_GET_VARS['CustomerID'])) {
$colname_RSexhchange = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['CustomerID'] : addslashes($HTTP_GET_VARS['CustomerID']);
}
mysql_select_db($database_connDiamond, $connDiamond);
$query_RSexhchange = sprintf("SELECT * FROM linedetails WHERE CustomerID = %s", $colname_RSexhchange);
$RSexhchange = mysql_query($query_RSexhchange, $connDiamond) or die(mysql_error());
$row_RSexhchange = mysql_fetch_assoc($RSexhchange);
$totalRows_RSexhchange = mysql_num_rows($RSexhchange);
</head>
// in the body section:
<form action="<?php echo $editFormAction; ?>" method="POST" name="UpdExch" id="UpdExch">
<p>Company: </p>
<p>
<input name="hiddenField" type="hidden" value="<?php echo $row_RSexhchange['CustomerID']; ?>">
</p>
<p><?php echo $row_RSexhchange['CustomerID']; ?> </p>
<table width="619" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr bgcolor="#0066CC">
<td width="132"> <p align="center"><strong><font color="#FFFFFF">Exchange</font></strong></p></td>
<td width="70"> <p align="center"><strong><font color="#FFFFFF">Qty</font></strong></p></td>
<td width="176"> <p align="center"><strong><font color="#FFFFFF">Usage</font></strong></p></td>
<td width="51"> <p align="center"><strong><font color="#FFFFFF">ISDN</font></strong></p></td>
<td width="75"> <p align="center"><strong><font color="#FFFFFF">LineProvider</font></strong></p></td>
</tr>
<?php do { ?>
<tr>
<td>
<p align="center">
<input name="exchange" type="text" id="exchange" value="<?php echo $row_RSexhchange['Exchange']; ?>">
</p></td>
<td><p align="center">
<input name="qty" type="text" id="qty" value="<?php echo $row_RSexhchange['Quantity1']; ?>" size="3">
</p></td>
<td><p align="center">
<input name="usage" type="text" id="usage" value="<?php echo $row_RSexhchange['Usage']; ?>">
</p></td>
<td><p align="center">
<input name="isdn2" type="text" id="isdn2" value="<?php echo $row_RSexhchange['ISDN2']; ?>" size="5">
</p></td>
<td><p align="center">
<input name="lineprov" type="text" id="lineprov" value="<?php echo $row_RSexhchange['LineProvider']; ?>">
</p></td>
</tr>
<?php } while ($row_RSexhchange = mysql_fetch_assoc($RSexhchange)); ?>
</table>
<p>
<input name="Update" type="submit" id="Update" value="Update">
</p>
<p> </p>
<input type="hidden" name="MM_update" value="UpdExch">
</form>
</body>
I suppose now you are going to say - TOO much code?
Thanks for any help you can give.
Brian