Me and my friend are working on a independent newspaper for this online game called <a href=http://www.jottonia.no>Jottonia</a>
I have been unsucessful in making the editor (where they will edit stories) work. The form works fine, the problem is when you make changes (edit) a story and then hit enter the mysql database is not updating. The code i'm using (the full code for the editor) is below:
<?
$epublish = $Array[epublish];
$id = $edit;
if($level < 2) {
echo "This editor is for Cheif Editors only!";
}else{
if(($edit != '') && ($epublish == '')) {
mysql_connect("$host", "$username", "$password") or die (mysql_error());
mysql_select_db('simgame_files') or die (mysql_error());
$sql = "SELECT * FROM news WHERE id=$edit";
$result = mysql_query($sql) or die (mysql_error());
while ($Row = mysql_fetch_array($result)) {
$sname = $Row[sname];
$subheading = $Row[subheading];
$stext = $Row[stext];
$sbrief = $Row[sbrief];
$ssection = $Row[ssection];
echo "<form method=\"POST\" action=\"editor.php\">
<br>Story Section: <select size=\"1\" name=\"Array[ssection]\">";
if($ssection == Ed) { echo "<option selected value=\"Ed\">Editorials</option><option value=\"Po\">Politics</option><option value=\"So\">Social</option><option value=\"Ju\">Justice</option><option value=\"Co\">Columnists</option></select>";
}elseif($ssection == Po) { echo "<option selected value=\"Po\">Politics</option><option value=\"Ed\">Editorials</option><option value=\"So\">Social</option><option value=\"Ju\">Justice</option><option value=\"Co\">Columnists</option></select>";
}elseif($ssection == So) { echo "<option selected value=\"So\">Social</option><option value=\"Po\">Politics</option><option value=\"Ed\">Editorial</option><option value=\"Ju\">Justice</option><option value=\"Co\">Columnists</option></select>";
}elseif($ssection == Ju) { echo "<option selected value=\"Ju\">Justice</option><option value=\"Po\">Politics</option><option value=\"So\">Social</option><option value=\"Ed\">Editorials</option><option value=\"Co\">Columnists</option></select>";
}elseif($ssection == Co) { echo "<option selected value=\"Co\">Columnists</option><option value=\"Po\">Politics</option><option value=\"So\">Social</option><option value=\"Ju\">Justice</option><option value=\"Ed\">Editorial</option></select>";
}
echo "<br>Story Title: <input type=\"text\" name=\"Array[stitle]\" size=\"20\" value=\"$sname\">
<br>Sub Title: <input type=\"text\" name=\"Array[sheading]\" size=\"20\" value=\"$subheading\">
<br>Story Brief:<input type=\"text\" name=\"Array[sbrief]\" size=\"21\" value=\"$sbrief\">
<p>Full Text of Story:
<br><textarea rows=\"13\" name=\"Array[fstory]\" cols=\"30\">$stext</textarea>
<p>
</p>
<p><input type=\"submit\" value=\"Publish\" name=\"Array[epublish]\"></p>
</form>";
}
}
if(($epublish != '') && ($level >= 2)) {
echo "<b>$id</b>";
$sname = $Array[stitle];
$subheading = $Array[sheading];
$sbrief = $Array[sbrief];
$stext = $Arry[fstory];
$ssection = $Array[ssection];
mysql_connect("$host", "$username", "$password") or die (mysql_error());
mysql_select_db('simgame_files') or die (mysql_error());
$sql = "UPDATE news SET sname='$sname', subheading='$subheading', sbrief='$sbrief', stext='$stext', ssection='$ssection', reviewed=1 WHERE id='$id' LIMIT 1";
mysql_query($sql) or die (mysql_error());
echo "Successfully Editeded & Published";
}
echo"<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>";
}
?>
[code=php]