peterisgb Posted December 6, 2011 Share Posted December 6, 2011 Hi, i'm been working on enabling the Help Tutorial to be abled to update from the staff page without going into the server. Well here is what i have so far <?php include "sglobals.php"; switch($_GET['action']) { default: index(); break; } function index() { global $db,$h,$set; print "<h3>Help Tutorial</h3> <form action='helptut.php?action=helpupdate' method='post'> <textarea rows=30 cols=90 name='helptext' class='input'>{$set['help']}</textarea><br /> <input type='submit' value='Update Help Tutorial' /></form>"; } function helpupdate() { global $db,$h,$set; $db->query("UPDATE settings SET conf_value='{$_POST['helptext']}' WHERE conf_name='help'"); print "Help Updated!<a href='helptut.php'>Back</a>"; } $h->endpage(); ?> The problem i am having is that it shows up the text within the box, but when you click update is doesnt update, is just goes back to the same page, the link shows its gone to the right page but thats it. If some could help me figure out whats wrong they can use this aswell, add Fields 'Help' to the Table 'Settings' Quote Link to comment Share on other sites More sharing options...
Djkanna Posted December 6, 2011 Share Posted December 6, 2011 case 'helpupdate': helpupdate(); break; In your switch statement. Quote Link to comment Share on other sites More sharing options...
peterisgb Posted December 7, 2011 Author Share Posted December 7, 2011 duh lol, thanks djkanna, this works a charm now Here is completed file for those who to wish to use this <?php include "sglobals.php"; //This contains general thingies switch($_GET['action']) { case 'helpupdate': helpupdate(); break; default: index(); break; } function index() { global $db,$h,$set; print "<h3>Help Tutorial</h3> <form action='helptut.php?action=helpupdate' method='post'> <textarea rows=30 cols=90 name='helptext' class='input'>{$set['help']}</textarea><br /> <input type='submit' value='Update Help Tutorial' /></form>"; } function helpupdate() { global $db,$h,$set; if($_POST['helptext']) { $db->query("UPDATE settings SET conf_value='{$_POST['helptext']}' WHERE conf_name='help'"); $set['help']=stripslashes($_POST['helptext']); print "Help Updated!<a href='helptut.php'>Back</a>"; } } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.