kacete
New Member
- Messages
- 5
- Reaction score
- 0
- Points
- 0
Hello guys, I could use another eyes on this code, i'm trying to make an admin for a custom module. The module and everything works except the admin part to edit an already existing article. It does get the values from the database and displays them on the boxes, but after modifying and clicking Edit to submit the form it doesn't make any changes.
Thank you
PHP:
function EditSpecial($sid) {
global $prefix, $db, $admin_file;
include("header.php");
GraphicAdmin();
title(""._SPECIALSMANAGER."");
OpenTable();
$sid = intval($sid);
$result = $db->sql_query("SELECT * FROM ".$prefix."_specials WHERE sid='$sid'");
$ency = $db->sql_fetchrow($result);
$ency['stitle'] = filter($ency['stitle'], "nohtml");
$ency['simg'] = filter($ency['simg'], "nohtml");
$ency['sband'] = filter($ency['sband']);
$ency['stxt'] = filter($ency['stxt']);
echo "<center><b>"._SPECIALSEDIT."</b></center><br><br>"
."<form action=\"".$admin_file.".php\" method=\"post\">"
."<b>"._SPECIALSTITLE.":</b><br>"
."<input type=\"text\" name=\"stitle\" size=\"50\" maxlength=\"255\" value=\"$ency[stitle]\"><br><br>"
."<b>"._SPECIALSIMAGE.":</b><br>Located in images/specials/.<br>"
."<input type=\"text\" name=\"simg\" size=\"50\" maxlength=\"255\" value=\"$ency[simg]\"><br><br>"
."<b>"._SPECIALSBANDS.":</b><br>"
."<textarea name=\"sband\" cols=\"100\" rows=\"10\">$ency[sband]</textarea><br><br>"
."<b>"._SPECIALSTEXT.":</b><br>"
."<textarea name=\"stxt\" cols=\"100\" rows=\"20\">$ency[stxt]</textarea><br><br>"
."<input type=\"hidden\" name=\"op\" value=\"SaveEditSpecial\">"
."<input type=\"hidden\" name=\"sid\" value=\"$sid\">"
."<input type=\"submit\" value=\""._EDIT."\">"
."</form>";
CloseTable();
include("footer.php");
}
function SaveEditSpecial($sid, $stitle, $simg, $sband, $stxt) {
global $prefix, $db, $admin_file;
$sid = intval($sid);
$db->sql_query("UPDATE ".$prefix."_specials SET stitle='$stitle' simg='$simg' sband='$sband' stxt='$stxt' WHERE sid='$sid'");
Header("Location: ".$admin_file.".php?op=SpecialsList");
}
Thank you