if -else help
Well I am not the best PHP programmer in the world and never will be lol. But I have been developing on my server (cPanel, apache, php,mysql) and have done some work for someone and the site is going on another server. and for some reason when i call the file dynamically like http://sitename.com/admin/edit_job.php?id=6&edit=show it will no longer work. The site worked fine on my server and now its moved to this new server it wont parse right. It just shows the javascript drop down. It would used to go to the edit page. http://dimonandbacorn.com/test/edit_job.php is what I am working on now. And I know the main issue somewhere is the $PHP_SELF and the problem lays with
Code:if ($edit == "show") {
is there a new way of doing this?
the code is below minus the javascript. i have that in the page but not included below.
Like I said im not the best and my stuff does what it needs to do (on my server....lol)
Code:<?
require "../config.inc";
# edit - show
if ($edit == "show") {$db = mysql_connect("$dbhost", "$dbuser", "$dbpassword");
mysql_select_db("$dbname",$db);$result = mysql_query("SELECT * FROM jobs WHERE id = '$id'",$db);
$jobz = mysql_fetch_array($result);do {
$id = ($jobz["id"]);
$job_title = ($jobz["job_title"]);
$description = ($jobz["description"]);
$active = ($jobz["active"]);echo "
<form method=\"post\" action=\"?id=$id&edit=done\"><input type=\"hidden\" name=\"id\" value=\"$id\">
<b>Job Title</b><br>
<INPUT TYPE=\"TEXT\" NAME=\"job_title\" size=\"35\" maxlength=\"70\" class=\"text-field\" value=\"$job_title\"><p><b>Job Description</b><br>
<TEXTAREA NAME=\"description\" ROWS=\"5\" COLS=\"65\" class=\"text-field2\">$description</TEXTAREA><p><b>Set Listing Active</b><br>";
if ($active == "0") {
echo "<select NAME=\"active\">
<OPTION VALUE=\"0\" NAME=\"active\" SELECTED>No</option>
<OPTION VALUE=\"1\" NAME=\"acitve\">Yes</option>
</select>";
} else {
echo "<select NAME=\"active\">
<OPTION VALUE=\"0\" NAME=\"active\">No</option>
<OPTION VALUE=\"1\" NAME=\"acitve\" SELECTED>Yes</option>
</select>";
}echo "<p>
<input type=\"Submit\" name=\"submit\" value=\"Enter Information\" style=\"border:1px solid #C80708; background-color: #cccccc; color: #000000; font-weight: bold\">";} while ($jobz = mysql_fetch_array($result));
echo "</form>";
#edit - done
} elseif ($edit == "done") {$db = mysql_connect("$dbhost", "$dbuser", "$dbpassword");
mysql_select_db("$dbname",$db);$sql = "UPDATE jobs SET id='$id',job_title='$job_title',description='$description',active='$active' WHERE id=$id";
//replace news with your table name above
$result = mysql_query($sql);
echo "<center><span class=\"main\">Thank you! Information updated.<p>
<a href=\"$PHP_SELF\">Edit Another Job</a> |
<a href=\"index.php\">» Back to Control Panel</a></span></center>";#edit - else
} else {$db = mysql_connect("$dbhost", "$dbuser", "$dbpassword");
mysql_select_db("$dbname",$db);$result = mysql_query("SELECT * FROM jobs ORDER BY id",$db);
$jobz = mysql_fetch_array($result);echo "<form name=form2>
<select onChange=\"MM_jumpMenu('parent',this,0)\" name=menu2>
<option value=\"\">Make a Selection</option>";do {
$id = ($jobz["id"]);
$job_title = ($jobz["job_title"]);echo "<option value=\"?id=$id&edit=show\">$id - $job_title</option>";
} while ($jobz = mysql_fetch_array($result));
echo "</select></form>";
}
?>

