:) this page name is search.php which gets siteID from the databse and show in LISTBOX.
<form action="site_report.php" method="post">
<?php
$con = mysql_connect("localhost","xxxx","xxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("onm", $con);
$query="SELECT SiteId FROM SitePInfo WHERE Region='Central 1' ";
$result = mysql_query ($query);
echo "<select name='SiteId'>\n";
echo "<option value=''>Select One</option>\n";
while($nt=mysql_fetch_array($result))
{
echo "<option value='$nt[SiteId]'>$nt[SiteId]</option>\n";
}
echo "</select>";
?>
<input type="submit" value="Search ID" />
</form>
and here is site_report.php which show report.
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$a= $_POST["SiteId"];
mysql_select_db("onm", $con);
$result = mysql_query("SELECT * FROM sitepinfo
WHERE SiteId='$a' ");
while($row = mysql_fetch_array($result))
{
echo "<table cellpadding=2 cellspacing=2 width=100%>
<tr>
</tr>";
echo "<tr>";
echo "<th bgcolor=#5D9BCC >SiteID</th>";
echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=#5D9BCC>Alias</th>";
echo "<td bgcolor=#FEE9A9>" . $row['Name'] . "</td>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=#5D9BCC>Longitude</th>";
echo "<td bgcolor=#FEE9A9>" . $row['Address'] . "</td>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=#5D9BCC>Latitude</th>";
echo "<td bgcolor=#FEE9A9>" . $row['City'] . "</td>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=#5D9BCC>Agreement</th>";
echo "<td bgcolor=#9BCB5D><a href=".$row['pdf'].">".$row['pdf']."</a></td>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=#5D9BCC>Purchase Order</th>";
echo "<td bgcolor=#CB9B5D><a href=".$row['pdf'].">".$row['pdf']."</a></td>";
echo "</tr>";
echo "<tr>";
echo "<td bgcolor=#9B5DCA><a href='update.php?id={$row[SiteId]}'>".stripslashes(Update)."</a>
</td>";
echo "</tr>";
echo "<tr>";
echo "<td bgcolor=#9B5DCA><a href='delete.php?id={$row[SiteId]}'>".stripslashes(delete)."</a>
</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
now this i a form for update page name is form.php
<?
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("new", $con);
$result = mysql_query("SELECT * FROM abc
WHERE SiteId='C-SIL-4441' "); // I just get one value at this time
while($row = mysql_fetch_array($result))
{
echo "<table cellpadding=2 cellspacing=2 width=100%>
<tr>
</tr>";
echo "<tr>";
echo "<th bgcolor=#5D9BCC >SiteID</th>";
echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>";
echo "<td bgcolor=#FEE9A9>" . $row['Name'] . "</td>";
echo "<td bgcolor=#FEE9A9>" . $row['Address'] . "</td>";
echo "<td bgcolor=#FEE9A9>" . $row['City'] . "</td>"; // show value in cell
$b =$row['SiteId'];
$c =$row['Name'];
$d =$row['Address'];
$e =$row['City'];// store value in $b
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
<form action="update2.php" method="post">
<table>
<tr>
<td>name</td>
<td>
<input type="text" name="username" id="username" value="<?php echo $c; ?>" /> </td></tr>
<tr>
<td>Address</td>
<td>
<input type="text" name="address" id="address" value="<?php echo $d; ?>"></td></tr>
<tr>
<td>city</td>
<td>
<input type="text" id="city" name="city" value="<?php echo $e; ?>">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Update"/>
</td>
</tr>
<input type="text" value="<?php echo $b; ?>" name="siteid">
</table>
</body>
</html>
and last page is update2.php
which gets the value from form.php and update in DB.
I have a problem how I post the
site_report.php siteid into form.php field?