Monkey644 Posted January 6, 2010 Posted January 6, 2010 Hey all, Can one you with your expert skills, help me out by making the following function work. It currently loads the input area but doesn't submit... function gang_staff_status(){global $db,$ir,$gangdata;if(isset($_POST['subm'])){$db->query("UPDATE gangs SET gangSTATUS={$_POST['vp']} WHERE gangID={$gangdata['gangID']}");print "Gang Status changed to {$gangdata['gangSTATUS']}";}else{print "<form action='yourgang.php?action=staff&act2=vicepres' method='post'>Enter the ID of the new vice-president. <input type='hidden' name='subm' value='submit' />ID: <input type='text' name='vp' value='{$gangdata['gangSTATUS']}' maxlength='10' width='7' /> <input type='submit' value='Change' /></form>";}} If someone could sort this out and post it for me, i would be grateful. Quote
Guest Null Posted January 6, 2010 Posted January 6, 2010 Why is the button invisible? and the input type has to be a submit, it cannot be hidden or itll act as hidden as far as i know Quote
Dayo Posted January 6, 2010 Posted January 6, 2010 try this function gang_staff_status(){ global $db,$ir,$gangdata; if(isset($_POST['vp'])){ $db->query("UPDATE gangs SET gangSTATUS=".mysql_real_escape_string($_POST['vp'])." WHERE gangID={$gangdata['gangID']}"); print "Gang Status changed to ".$gangdata['gangSTATUS']; }else{print "<form action='yourgang.php?action=staff&act2=vicepres' method='post'>Enter the ID of the new vice-president. ID: <input type='text' name='vp' value='".$gangdata['gangSTATUS']."' maxlength='10' width='7' /> <input type='submit' value='Change' /></form>";} } Quote
Monkey644 Posted January 6, 2010 Author Posted January 6, 2010 Nothing, just get Error processing request, error has been logged. Quote
Dayo Posted January 6, 2010 Posted January 6, 2010 this? function gang_staff_status(){ global $db,$ir,$gangdata; if(isset($_POST['vp'])){ $db->query("UPDATE gangs SET gangSTATUS='".mysql_real_escape_string($_POST['vp'])."' WHERE gangID='".$gangdata['gangID']."'"); echo mysql_error(); print "Gang Status changed to ".$gangdata['gangSTATUS']; }else{print "<form action='yourgang.php?action=staff&act2=vicepres' method='post'>Enter the ID of the new vice-president. ID: <input type='text' name='vp' value='".$gangdata['gangSTATUS']."' maxlength='10' width='7' /> <input type='submit' value='Change' /></form>";} } Quote
Dayo Posted January 6, 2010 Posted January 6, 2010 can you disable that message? ... also just a question you have made the table gangSTATUS Quote
Monkey644 Posted January 6, 2010 Author Posted January 6, 2010 Yes i have and i dont know if i can disable, ill have a look Quote
Monkey644 Posted January 6, 2010 Author Posted January 6, 2010 Now i'm getting You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Warring' WHERE gangID='24'', '/yourgang.php', unix_timestamp())' at line 2 Quote
Monkey644 Posted January 6, 2010 Author Posted January 6, 2010 Fixed it, thanks to everyones help :) Quote
Dayo Posted January 7, 2010 Posted January 7, 2010 no problem mate, try to find where your errors are loged, its much easier knowing what the error is rather then taling a stab in the dark Quote
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.