Hi All.
I create form/page and would like to show whole row(s) under NOTE-1 if value of field TYPE is 3 exist and hide whole row(s) under NOTE-1 if value of field TYPE is 3 doesn\'t exist`for according ID. And I would like to show whole row(s) under NOTE-2 if value of field TYPE are 1 or 2 exist and hide whole row(s) under NOTE-2 if value of field TYPE are 1 or 2 doesn\'t exist for according ID. That is my code.
<?php
include (\'Connections/dbconn.php\');
if (!($connection = @ mysql_pconnect($hostname, $username, $password)))
die("Could not connect to database");
if (!mysql_select_db($dbName, $connection))
showerror( );
$ID = $_REQUEST[\'ID\'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form method="POST" action="Update.php" name="update">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<?
$query1 = "SELECT ID, Type, Date, Note
FROM dbo.Test
WHERE ID = " . $ID;
if (!($result1 = @ mysql_query($query1, $connection)))
showerror( );
while($row1 = mysql_fetch_array($result1))
{
$formVars = array( );
$formVars[\'Type\'] = $row1[\'Type\'];
$formVars[\'Date\'] = $row1[\'Date\'];
$formVars[\'Note\'] = $row1[\'Note\'];
if ($formVars[\'Type\'] == 3)
{
?>
<tr>
<td width="7%"><input type="hidden" name="Type" value="<? echo $Type; ?>"></td>
</tr>
<tr align="center">
<td width="7%"><input name="submit" type="submit" value="add"></td>
<td width="18%">DATE</td>
<td width="75%">NOTE-1</td>
</tr>
<tr>
<td align="center" valign="bottom"><input name="note" type="submit" value="del"></td>
<td>
<?php
if(isset($formVars[\'Date\']) && $formVars[\'Date\'] != "")
{
$formVars[\'Date\'] = date("m/d/Y", strtotime($formVars[\'Date\']));
}
?>
<input name="NoteDate" type="text" value="<?php echo $formVars[\'Date\']; ?>" size="20">
</td>
<td><input type="text" name="Note" value="<?php echo $formVars[\'Note\']; ?>" size=107></td>
</tr>
<?
}
if ($formVars[\'Type\'] == 1 || $formVars[\'Type\'] == 2)
{
?>
<tr>
<td colspan="4" align="center"> </td>
</tr>
<tr align="center">
<td width="7%" align="center"><input name="submit" type="submit" value="add"></td>
<td width="18%">DATE</td>
<td width="75%">NOTE-2</td>
</tr>
<tr>
<td align="center" valign="bottom"><input name="note" type="submit" value="del"></td>
<td>
<?php
if(isset($formVars[\'Date\']) && $formVars[\'Date\'] != "")
{
$formVars[\'Date\'] = date("m/d/Y", strtotime($formVars[\'Date\']));
}
?>
<input name="NoteDate" type="text" value="<?php echo $formVars[\'Date\']; ?>" size="20">
</td>
<td><input type="text" name="Note" value="<?php echo $formVars[\'Note\']; ?>" size=107></td>
</tr>
<? }
}
?>
</table>
</form>
</body>
</html>
Thanks.