I am at a standstill.
I have the following code with different approaches to display field content:
****[Coments on code for this post]
<?php // Home Content Add Products
// Begin Edit / Delete
echo $id;
echo " ." .$mode; //**** REMEMBER TO DELETE THIS BEFORE PRODUCTION
If ($mode == 'edit' || $mode == 'delete');
**[ The above takes a variable passed from the previous URL]
{
// Display Record to edit or delete
mysql_connect("localhost", "THE_DATABASE", "") or die("There was a problem connecting to the database");
if (!msql_connect)
{
echo "There is a problem connecting to the server.";
exit;
}
mysql_select_db("MY_TABLE");
$query = "SELECT FROM homecontent WHERE hpcid='$id'";
$result = mysql_query($query);
if (!$result)
{
echo "The query failed.";
exit;
}
//$row = mysql_fetch_array($result);
$num_rows = mysql_num_rows($result);
echo $num_rows;
echo "\n";*[for some reason I do not get a newline here]
*[ Below is test code to see if I could print the info from the DB--I could print any variable from the record (by way of passed rec_id from prev page]**
//while ($row = mysql_fetch_array($result))
//{
// echo $row["hpcid"];
// echo $row["headline"];
//
// echo "\n";
//}
// Display from
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Home Page Management</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h3>Edit/Delete Home Page Content</h3>
****
<form action="home_action.php" method="post">
<table width="600" border="0" cellspacing="0" cellpadding="0">
<!--DWLayoutTable-->
<tr>
<td width="15"> </td>
<td width="122"><div align="right">Headline:</div></td>
<td width="463"><input name="headline" type="text" value="<?= $post['headline']?>" size="50">
Page Pos.:
<select name="contentpos">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td nowrap><div align="right">Image Path:</div></td>
<td><input name="imagepath" type="text" <?echo "value=\"$imagepath\"";?> size="50">
Image Pos.: <select name="imagepos" value="<?= $row["imagepos"]?>">
<option value=" ">None</option>
<option value="L">Left</option>
<option value="R">Right</option>
<option value="T">Top</option>
<option value="B">Bottom</option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><div align="right">Active: </div></td>
<td><select name="active" selected="<?= $row["active"]?>">
<option value="1">No</option>
<option value="2">Yes</option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td valign="top"><div align="right">Content:</div></td>
<td><textarea name="content" value="<?=$POST['content']?>" cols="80" rows="20"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="2"><div align="right">
<input type="submit" name="submit" value="Submit"> <input name=cancel" type="button" value="Cancel">
</div></td>
</tr>
<tr>
<td height="101"></td>
<td></td>
<td></td>
</tr>
</table>
</form>
I also need to know how to display the info for a drop down select with many otions (like ST or Country) and still be able to use the select to edit the record.
Thanks