Jump to content
MakeWebGames

Need help with a function...


Monkey644

Recommended Posts

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.

Link to comment
Share on other sites

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>";}
}
Link to comment
Share on other sites

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>";}
}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...