update and delete forms
Hi, I have the following problem:
Situation :
You can login in the login page, where also the company where you belong to is put in a session variable : $companyCheck
Then in the menu you can click on a link, for viewing, adding and removing licenses from different companies.
This is the code from the license-page :
<?php require_once('../../Connections/fisherintranet.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_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO licenties (company, license) VALUES (%s, %s)",
GetSQLValueString($HTTP_POST_VARS['company'], "text"),
GetSQLValueString($HTTP_POST_VARS['license'], "text"));
mysql_select_db($database_fisherintranet, $fisherintranet);
$Result1 = mysql_query($insertSQL, $fisherintranet) or die(mysql_error());
}
session_start();
if ($HTTP_SESSION_VARS["statusCheck"] != "Admin")
header("Location: menu.php");
$colname_licenties = "1";
if (isset($HTTP_SESSION_VARS['companyCheck'])) {
$colname_licenties = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['companyCheck'] : addslashes($HTTP_SESSION_VARS['companyCheck']);
}
mysql_select_db($database_fisherintranet, $fisherintranet);
$query_licenties = sprintf("SELECT license FROM licenties WHERE company = '%s' ORDER BY license ASC", $colname_licenties);
$licenties = mysql_query($query_licenties, $fisherintranet) or die(mysql_error());
$row_licenties = mysql_fetch_assoc($licenties);
$totalRows_licenties = mysql_num_rows($licenties);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p align="center">These are the licenses from <?php echo $companyCheck; ?></p>
<p> </p>
<table width="30%" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#999966">
<tr>
<td bgcolor="#999900"><div align="center"><font color="#FFFFFF"><strong>licenses</strong></font></div></td>
</tr>
<?php do { ?>
<tr>
<td><div align="center"><font color="#FFFFFF"><?php echo $row_licenties['license']; ?></font></div></td>
</tr>
<?php } while ($row_licenties = mysql_fetch_assoc($licenties)); ?>
</table>
<p> </p>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table width="40%" align="center">
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="hidden" name="company" value="<?php echo $companyCheck; ?>" size="32"></td>
</tr>
<tr valign="baseline" bgcolor="#999966">
<td align="right" nowrap bgcolor="#999900"><div align="center"><font color="#FFFFFF"><strong>License:</strong></font></div></td>
<td><div align="center">
<input type="text" name="license" value="" size="32">
</div></td>
</tr>
<tr valign="baseline" bgcolor="#999966">
<td align="right" nowrap> </td>
<td><div align="center">
<input type="submit" value="Add License">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p align="center"> </p>
<p align="center"><a href="menu.php">Back to menu</a></p>
</body>
</html>
<?php
mysql_free_result($licenties);
?>
You can see and add the licenses from your own company, but I also want to remove and update them (by checking a box and then chose remove or update or something)
But I've tried several things, but nothing works. Can someone please help me ?
Thanks !!!!