csgcarl Posted June 24, 2007 Share Posted June 24, 2007 Hello, I've tried but havnt got it to work :'(. What I have is a status(drop down menu) you should be able to select from drop down and it will update the status field in db. Heres the code: <? function appjoin($admin,$retnmsg){ global $config; $out[body].=" <br> <center> <table width='580' border='0' cellspacing='1' cellpadding='4'> <tr> <td width='100%' valign='center' align='center' colspan='8'> <form method='post'> <select name='id'>"; $result=mysql_query("SELECT * FROM apply ORDER BY signupid"); while($links = mysql_fetch_array($result)) { $id = $links["signupid"]; $name = $links["name"]; $out[body].="<option value='$id'><font color='#000000'>ID: $id Name: $name</option>\n"; } $app=mysql_query("SELECT name FROM apply WHERE signupid='$id'"); $app=mysql_fetch_array($app); $out[body].="</select> <script language='javascript'>var confirmdelete='Are you 100% sure you want to DELETE this application?';</script> <input type='hidden' name='admin[ladderid]' value='$admin[ladderid]'> <input type='hidden' name='admin[name]' value='$admin[name]'> <input type='hidden' name='admin[pass]' value='$admin[pass]'> <input type='hidden' name='action' value='appdelete'> <input type='submit' name='submit' value='Delete' onClick='return confirm(confirmdelete);'> </form></td> </tr></table> <br> <center> <table width='90%' border='0' cellspacing='1' cellpadding='2' bgcolor='000000'> <form method='post'> <tr bgcolor='$config[altcolor]'> <td width='100%' background='$config[bg]' valign='center' align='center' colspan='2'><b><font color='ffffff'><font color='#ffffff'>$config[sitename] - Application</b> "; if($retnmsg){ $out[body].=" <font color='#ffffff' size='1'>($retnmsg)</font>"; } $app=mysql_query("SELECT signupid, username, gamename, name, dob, gender, email, skype, aim, msn, position, info, info1, time, ip,DATE_FORMAT(time,'%M %d, %Y %r'),ip FROM apply ORDER BY signupid"); while(list($signupid,$username,$name,$gamename,$dob,$gender,$email,$skype,$aim,$msn,$position,$info,$info1,$time,$ip)=mysql_fetch_row($app)){ $account++; if($config[altcolorx]==$config[altcolora]){ $config[altcolorx]="$config[altcolorb]"; }else{ $config[altcolorx]="$config[altcolora]"; } $space=array(" "); $out[body].=" </td> </tr> <tr bgcolor='$config[altcolorx]'> <td width='50%' background='$config[bg]'><b><font color='ffffff'><font color='#ffffff'> Application ID:</b> $signupid</b></td> <td width='50%' background='$config[bg]'><b><font color='ffffff'><font color='#ffffff'></b> <tr bgcolor='$config[altcolorx]'> <td width='30%'> <B><font color='#000000'>Position:</b> <font color='#000000'>$position<br> <B><font color='#000000'>User Name:</b><font color='#000000'> $username<br> <B><font color='#000000'>Full Name:</b><font color='#000000'> $gamename<br> <B><font color='#000000'>Game Name:</b><font color='#000000'> $name<br> <B><font color='#000000'>Date Of Birth:</b><font color='#000000'> $dob<br> <B><font color='#000000'>Gender:</b><font color='#000000'> $gender<br> <B><font color='#000000'>Skype:</b><font color='#000000'> $skype<br> <B><font color='#000000'>Aim:</b><font color='#000000'> $aim<br> <B><font color='#000000'>MSN:</b><font color='#000000'> $msn<br> <B><font color='#000000'>Email:</b><font color='#000000'> <a href='mailto:$email'>$email</a><br> <B><font color='#000000'>Tell us about you:</b><font color='#000000'> $info<br> <B><font color='#000000'>Why would you like to work for BSE?</b><font color='#000000'> $info1<br> <b><font color='#000000'>Date:</b><font color='#000000'> $time<Br> <b><font color='#000000'>IP Address:</b> $ip </td> <td width='60%'>Application Status: <width='60%' valign='center' align='center'> <SELECT class='button' NAME='app[status]'> <option value='$apply[status]' >$apply[status]</option> <option value='Pending' >Pending</option> <option value='Interview' >Interview</option> <option value='Denied' >Denied</option> <option value='Accepted' >Accepted</option> </SELECT> <input type='hidden' name='action' value='apply'> <input type='submit' name='submit' value='Update Status >>'></td> </form> </tr> "; } $out[body].=" </table> <br> <form method='post'> <input type='hidden' name='admin[ladderid]' value='$admin[ladderid]'> <input type='hidden' name='admin[name]' value='$admin[name]'> <input type='hidden' name='admin[pass]' value='$admin[pass]'> <input type='hidden' name='action' value='adminlogin'> <input type='submit' name='submit' value='Admin Main'> </form>"; include("$config[html5]"); } /////////// FUNCTIONS Update-Delete Staff Signups////////////////////// function appdelete($admin,$app,$id){ global $config; $date = date("r"); mysql_query("DELETE FROM `apply` WHERE `signupid`='$id'"); $retnmsg="The Applicant has been removed!"; appjoin($admin,$retnmsg); $adminlog[admin]="$admin[name] : $admin[title]"; $adminlog[ladderid]="$admin[ladderid]"; $adminlog[details]="[Deleted Staff App]: App ID: $id"; adminlog($adminlog); } ?> The drop down I want to sort the code for is: <td width='60%'>Application Status: <width='60%' valign='center' align='center'> <SELECT class='button' NAME='app[status]'> <option value='$apply[status]' >$apply[status]</option> <option value='Pending' >Pending</option> <option value='Interview' >Interview</option> <option value='Denied' >Denied</option> <option value='Accepted' >Accepted</option> </SELECT> <input type='hidden' name='action' value='apply'> <input type='submit' name='submit' value='Update Status >>'></td> So the defualt value would be pending and when you select one of the other options from drop down and click 'Update Status' and it would change. Any help would be great, as said I have tried but I failed . Thanks, Carl Quote Link to comment Share on other sites More sharing options...
csgcarl Posted June 30, 2007 Author Share Posted June 30, 2007 Can any one help me please? Carl Quote Link to comment Share on other sites More sharing options...
corbin Posted June 30, 2007 Share Posted June 30, 2007 This is kinda vague since I don't feel like reading through your long code, but you'll just need to work with $_POST['app']['status']. For example: $q = mysql_query("UPDATE table SET column = '{$_POST['app']['status']}' WHERE some_column = 'something'"); 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.