<?php require_once('Connections/t77_connect.php'); ?>
<?php
$colname_doctype = "0";
if (isset($_GET['docType'])) {
$colname_doctype = (get_magic_quotes_gpc()) ? $_GET['docType'] : addslashes($_GET['docType']);
}
mysql_select_db($database_t77_connect, $t77_connect);
$query_doctype = sprintf("SELECT * FROM t77_bill_types WHERE t77_bill_types.bill_type = %s", $colname_doctype);
$doctype = mysql_query($query_doctype, $t77_connect) or die(mysql_error());
$row_doctype = mysql_fetch_assoc($doctype);
$totalRows_doctype = mysql_num_rows($doctype);
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"] == "form1")) {
$updateSQL = sprintf("UPDATE t77_bill_types SET type_description=%s WHERE bill_type=%s",
GetSQLValueString($HTTP_POST_VARS['type_description'], "text"),
GetSQLValueString($HTTP_POST_VARS['bill_type'], "int"));
mysql_select_db($database_t77_connect, $t77_connect);
$Result1 = mysql_query($updateSQL, $t77_connect) or die(mysql_error());
$updateGoTo = "close.php?ref=" . $_GET['ref'] . "quer=" . $_GET['quer'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="31"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"><img src="images/tabletopstart.gif" width="20" height="31" /></td>
<td><table width="100%" height="30" border="0" cellpadding="5" cellspacing="0">
<tr>
<td><p><strong>Edit document type</strong></p>
</td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="20">
<tr>
<td align="left" valign="top">
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table width="100%" align="center" class="tableBorder">
<tr valign="baseline">
<td nowrap align="right"><h1>Document type:</h1></td>
<td><input type="text" name="type_description" value="<?php echo $row_doctype['type_description']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Update document type"></td>
</tr>
</table>
<input type="hidden" name="bill_type" value="<?php echo $row_doctype['bill_type']; ?>">
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="bill_type" value="<?php echo $row_doctype['bill_type']; ?>">
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($doctype);
?>