I have a script that I use to update my pages via the internet. This works fine on all my other cpanel servers. But when I use this on my company's hosting account at Apollo Hosting it wont update the pages. Everything appears to wor properly but in the end it will not update the database. Can anyone see anything wrong with this that may prevent it from working properly.
PHP:
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_jumpMenuGo(selName,targ,restore){ //v3.0
var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//-->
</script>
<?
require "../config.inc";
$edit = $_GET['edit'];
$id = $_GET['id'];
# edit - show
if ($edit == "show") {
$db = mysql_connect("$dbhost", "$dbuser", "$dbpassword");
mysql_select_db("$dbname",$db);
$result = mysql_query("SELECT * FROM site WHERE id = '$id'",$db);
$content = mysql_fetch_array($result);
do {
$id = ($content["id"]);
$title = ($content["title"]);
$text = ($content["text"]);
echo "
<form method=\"post\" action=\"?id=$id&edit=done\">
<input type=\"hidden\" name=\"id\" value=\"$id\">
<b>Page Title</b><br>
<INPUT TYPE=\"TEXT\" NAME=\"title\" size=\"35\" maxlength=\"70\" class=\"text-field\" value=\"$title\"><p>
<b>Page Content</b><br>
<TEXTAREA NAME=\"text\" ROWS=\"30\" COLS=\"85\" class=\"text-field2\">$text</TEXTAREA><p>
<input type=\"Submit\" name=\"submit\" value=\"Enter Information\" style=\"border:1px solid #C80708; background-color: #cccccc; color: #000000; font-weight: bold\">";
} while ($content = mysql_fetch_array($result));
echo "</form>";
#edit - done
} elseif ($edit == "done") {
$db = mysql_connect("$dbhost", "$dbuser", "$dbpassword");
mysql_select_db("$dbname",$db);
$id = $_POST['id'];
$title = $_POST['title'];
$text = $_POST['text'];
$sql = "UPDATE site SET id='$id',title='$title',text='$text' 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=\"edit_pages.php\">Edit Another Page</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 site ORDER BY id",$db);
$content = 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 = ($content["id"]);
$title = ($content["title"]);
echo "<option value=\"?id=$id&edit=show\">$title</option>";
} while ($content = mysql_fetch_array($result));
echo "</select></form>";
}
?>