The first code excerpt is the list that calles the second page, and the second one is an excerpt of the second page. If I can get that part working then I can just copy and paste it throughout.
What I am trying to do is query a database, and get a list of information and from that list open up a form where I can add additional information.
<form action="process2.php" method="post">
<table>
<caption> ...
<br />
...
</caption>
<tr class="bold">
<td>Chain Name</td><td>Store Number</td><td>Select</td>
</tr>
<?php
for ($j = 0; $j < $i; $j++) {
$cname=mysql_result($result,$j,'storename');
$snum=mysql_result($result,$j,'storenum');
$key=mysql_result($result,$j,'key');
echo "<tr>";
echo "<td>";
echo $cname;
echo "</td>";
echo "<td>";
echo $snum;
echo "</td>";
echo "<td>";
echo "<input type='radio' value=".$key." name='status' />".$key."";
echo "</td>";
echo "</tr>";
}
?>
<tr>
<td>
<select name="cname">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td>
<td><input type="text" name="snumber" size="4" />
</td>
<td><input type="radio" value="other" name="status" />
</td>
</tr>
<tr>
<td><input type="submit" value="Check In" name="submit" /></td>
<td><input type="submit" value="Check Out" name="submit" /></td> <td><input type="submit" value="Logout" name="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
if ($submit=="Check In"){
if ( $key="other"){
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $table_name WHERE storename='$cname' AND storenum='$snumber'";
$result=mysql_query($sql);
if ( $row=mysql_fetch_assoc($result) ) {
$snum=$snumber;
$idat=$row["instdate"];
$tnam=$row["techname"];
$cnam=$cname;
$cty=$row["city"];
$ste=$row["state"];
$swloc=$row["switchlocation"];
$srvste=$row["serveronsite"];
$srvloc=$row["serverlocation"];
$tos=$row["timeonsite"];
$pa=$row["portsavailablebeforeswitcha"];
$pb=$row["portsavailablebeforeswitchb"];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="/include/css.css" />
<link rel="stylesheet" type="text/css" href="/include/print.css" media="print" />
<title>...</title>
</head>
<body>
<form action="checkin.php" method="post">
<table>
<caption>...
<br />
...
</caption>
<tr>
<td>Store Number:</td>
<td> <input type="text" name="storenumber" size="4" maxlength="4" value="<?php echo $snum?>" /></td>
<td>Date of Install:</td>
<td> <input type="text" name="instdate" value="<?php echo $idat?>" /></td>
<td>Tech Name:</td>
<td> <input type="text" name="techname" value="<?php echo $tnam?>" /></td>
</tr>
<tr>
<td>Store Chain:</td>
<td> <select name="storename">
<option value="<?php echo $cnam?>" selected="selected">
<?php echo $cnam?></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select></td>
<td>City:</td>
<td><input type="text" name="city" value="<?php echo $cty?>" /></td>
<td>State:</td>
<td><input type="text" name="state" size="2" maxlength="2" value="<?php echo $ste?>" /></td>
</tr>
<tr>
<td>Switch Location</td>
<td><select name="switchlocation">
<option value="<?php echo $swloc?>" selected="selected">
<?php echo $swloc?></option>
<option value="Managers Office">Managers Office</option>
<option value="Cash Office">Cash Office</option>
<option value="Electrical Closet">Electrical Closet</option>
<option value="Other">Other</option>
</select>
</td>
<td>Server On Site:</td>
<td> <input type="checkbox" name="serveronsite" value="1"<?php echo ($srvste == 1) ? " checked" : ""?> /></td>
<td>Server Location:</td>
<td><select name="serverlocation">
<option value="<?php echo $srvloc?>" selected="selected">
<?php echo $srvloc?></option>
<option value="Managers Office">Managers Office</option>
<option value="Cash Office">Cash Office</option>
<option value="Electrical Closet">Electrical Closet</option>
<option value="Other">Other</option>
</select>
</td>
</tr>
<tr>
<td>Other (Select other above):</td>
<td> <input type="text" name="switchlocation1" visibility="hidden" /></td>
<td></td>
<td></td>
<td>Other (Select other above):</td>
<td> <input type="text" name="serverlocation1" visibility="hidden" /></td>
</tr>
<tr>
<td>Tech Checkin Time:</td>
<td><input type="text" name="timeonsite" size="5" maxlength="5" value="<?php echo $tos?>" /></td>
</tr>
<tr>
<td>What ports are available in switch A:</td>
<td><td> <input type="text" name="portsa" size="18" maxlength="96" value="<?php echo $pa?>" /></td></td>
<td>What ports are available in switch B:</td>
<td><td> <input type="text" name="portsb" size="18" maxlength="96" value="<?php echo $pb?>" /></td></td>
</tr>
</table>
<table>
<tr>
<td>If you are checking a tech in then check this box:</td>
<td> <input type="checkbox" name="check" value="1" /> </td>
</tr>
<tr>
<td><input type="submit" name="checkin" value="Submit" /></td>
<td><input type="reset" name="reset" value="Reset" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
}
else{
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $table_name WHERE key='$key'";
$result=mysql_query($sql);
if ( $row=mysql_fetch_assoc($result) ) {
$snum=$row["storenum"];
$idat=$row["instdate"];
$tnam=$row["techname"];
$cnam=$row["storename"];
$cty=$row["city"];
$ste=$row["state"];
$swloc=$row["switchlocation"];
$srvste=$row["serveronsite"];
$srvloc=$row["serverlocation"];
$tos=$row["timeonsite"];
$pa=$row["portsavailablebeforeswitcha"];
$pb=$row["portsavailablebeforeswitchb"];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="/include/css.css" />
<link rel="stylesheet" type="text/css" href="/include/print.css" media="print" />
<title>AST Server Rollout Check In Page</title>
</head>
<body>
<form action="checkin.php" method="post">
<table>
<caption>...
<br />
...
</caption>
<tr>
<td>Store Number:</td>
<td> <input type="text" name="storenumber" size="4" maxlength="4" value="<?php echo $snum?>" /></td>
<td>Date of Install:</td>
<td> <input type="text" name="instdate" value="<?php echo $idat?>" /></td>
<td>Tech Name:</td>
<td> <input type="text" name="techname" value="<?php echo $tnam?>" /></td>
</tr>
<tr>
<td>Store Chain:</td>
<td> <select name="storename">
<option value="<?php echo $cnam?>" selected="selected">
<?php echo $cnam?></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select></td>
<td>City:</td>
<td><input type="text" name="city" value="<?php echo $cty?>" /></td>
<td>State:</td>
<td><input type="text" name="state" size="2" maxlength="2" value="<?php echo $ste?>" /></td>
</tr>
<tr>
<td>Switch Location</td>
<td><select name="switchlocation">
<option value="<?php echo $swloc?>" selected="selected">
<?php echo $swloc?></option>
<option value="Managers Office">Managers Office</option>
<option value="Cash Office">Cash Office</option>
<option value="Electrical Closet">Electrical Closet</option>
<option value="Other">Other</option>
</select>
</td>
<td>Server On Site:</td>
<td> <input type="checkbox" name="serveronsite" value="1"<?php echo ($srvste == 1) ? " checked" : ""?> /></td>
<td>Server Location:</td>
<td><select name="serverlocation">
<option value="<?php echo $srvloc?>" selected="selected">
<?php echo $srvloc?></option>
<option value="Managers Office">Managers Office</option>
<option value="Cash Office">Cash Office</option>
<option value="Electrical Closet">Electrical Closet</option>
<option value="Other">Other</option>
</select>
</td>
</tr>
<tr>
<td>Other (Select other above):</td>
<td> <input type="text" name="switchlocation1" visibility="hidden" /></td>
<td></td>
<td></td>
<td>Other (Select other above):</td>
<td> <input type="text" name="serverlocation1" visibility="hidden" /></td>
</tr>
<tr>
<td>Tech Checkin Time:</td>
<td><input type="text" name="timeonsite" size="5" maxlength="5" value="<?php echo $tos?>" /></td>
</tr>
<tr>
<td>What ports are available in switch A:</td>
<td><td> <input type="text" name="portsa" size="18" maxlength="96" value="<?php echo $pa?>" /></td></td>
<td>What ports are available in switch B:</td>
<td><td> <input type="text" name="portsb" size="18" maxlength="96" value="<?php echo $pb?>" /></td></td>
</tr>
</table>
<table>
<tr>
<td>If you are checking a tech in then check this box:</td>
<td> <input type="checkbox" name="check" value="1" /> </td>
</tr>
<tr>
<td><input type="submit" name="checkin" value="Submit" /></td>
<td><input type="reset" name="reset" value="Reset" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
}
}