Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3312042
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:56:51+00:00 2026-05-17T21:56:51+00:00

the below code shows a table with users to be accepted or declined. the

  • 0

the below code shows a table with users to be accepted or declined. the code as it is has a dropdown on the end allowing to either accept it, deny it or leave as is. there is a button on the bottom to submit the form and after that there should be a php script that decides which user is accepted, denied or still pending.

what would be the best approach to make this work since i find it hard to link the dropdown box and the id.

<table align='center' width='90%'>
                        <tr>
                            <center><td><strong>ID:</strong></td></center>
                            <center><td><strong>Name:</strong></td></center>
                            <center><td><strong>Level:</strong></td></center>
                            <center><td><strong>Job:</strong></td></center>
                            <center><td><strong>Guild:</strong></td></center>
                            <center><td><strong>Date:</strong></td></center>
                            <center><td><strong>Action:</strong></td></center>
                        </tr>
                        <?php
                        $id = 0;
                        $result=mysql_query("SELECT * FROM accounts WHERE active ='0' ORDER BY date LIMIT 10") or die(mysql_error());
                        while($row = mysql_fetch_array( $result )) {
                        $id = $id + 1;
                        ?>
                        <form method='POST' action=''>
                        <tr>
                            <center><td><?php echo $row['id']; ?></td></center>
                            <center><td><?php echo $row['user']; ?></td></center>
                            <center><td><?php echo $row['level']; ?></td></center>
                            <center><td><?php echo $row['job']; ?></td></center>
                            <center><td><?php echo $row['guild']; ?></td></center>
                            <center><td><?php echo $row['date']; ?></td></center>
                            <td>
                                <select name='action_<?php echo $row['id']; ?>'>
                                    <option value='none'>None</option>
                                    <option value='accept'>Accept</option>
                                    <option value='decline'>Decline</option>
                                </select>
                            </td>
                        </tr>
                        <?php } ?>
                        <tr>
                            <br /><td align='right'><input type='submit' value='Submit' name='submit' /></td>
                        </tr>
                        </form>

                    </table>
<?php 
            if(isset($_POST['submit'])) {
                if(isset($_POST['action_'.$row['id'].'']) && $_POST['action_'.$row['id'].''] == "accept" ) {
                    $acc = mysql_query("UPDATE `accounts` SET `active`='1' WHERE `id` = '".$row['id']."'");
                    echo "<meta http-equiv=refresh content=\"5; url=?wesofly=main&page=recruitment\">";
                }elseif(isset($_POST['action_'.$row['id'].'']) && $_POST['action_'.$row['id'].''] == "decline" ) {
                    $dec = mysql_query("DELETE * from `accounts` WHERE '".$row['id']."'");
                    echo "<meta http-equiv=refresh content=\"0; url=?wesofly=main&page=recruitment\">";
                }
            }
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:56:51+00:00Added an answer on May 17, 2026 at 9:56 pm

    Your code is confusing. Your WHILE loop starts before the form tag, but the WHILE loop closes before the form tag closes. This means that you are going to have multiple form elements.

    So, first of all, change that in your code. Next the way you want this to work is using arrays.

    Your drop down box should look like this

    <select name='action[<?php echo $row['id']; ?>]'>
      <option value='none'>None</option>
      <option value='accept'>Accept</option>
      <option value='decline'>Decline</option>
    </select>
    

    Then on the PHP side, you should be able to do something like

    foreach ($_REQUEST['action'] as $key => $value) {
       $id = $key;
       $status = $value;
       // put your code here to update the specific database item
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code shows below what i have done till now. Now what i need
The code below shows me (I think) that the for each loop is about
The example below shows the code I am using to test whether a user
The code below compiled in Debug configuration in VS2005 SP1 shows two messages with
The code below extracts links from a web page and shows them in a
I have the code below that hides and shows the navigational bar. It is
The code below is in WPF in .net 4, which shows a grid which
When the link below is clicked <a class=end href=#>End</a> The below code runs which
I am using below code to show jquery dialog, its working perfectly, Sub OpenDialog(ByVal
I use below code to show folder list in AlertDialog: ListDialog = new AlertDialog.Builder(MyActivity.this);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.