OK,
Here I go again:
I am appending 2 variables to the URL on the previous page. One is the mode (add, edit, delete) and the other is a record number for the edit/delete.
When I run the attached code the initial test loads the first form whether the $mode variable == "add, edit, or delete". I wanted the test to display the form filled out only for edit/delete.
There is another form (blank) for $mode == 'add'
Where am I missing this logic?
code:
<?php // Home Content Add
// Begin Edit / Delete
echo $id;
echo $mode;
/ This is to make sure the above variables are assigned on this
Page ( I don't know why..just wanted to be sure since the test below does not work/
$mode = $mode;
$id = $id;
//******* REMEMBER TO DELETE ABOVE BEFORE PUBLISHING
if (!$mode == 'add' || $mode == 'edit' || $mode == 'delete');
{
// Display Record to edit or delete. The mode and id comes from URL on prior page
mysql_connect("localhost", "root", "") 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("dunhill");
$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;
// Test to see the result variables below
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 or Delete Home Page Content</h3>
<form action="home_action.php" method="post">
snip...
</form>
snip
</body>
</html>
<?
}
// End Edit / Delete
*****the next form starts below
if ($mode == 'add')
{ // This form is dispalyed if edit or delete
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
snip.....