Advanced Search

Results 1 to 2 of 2

Thread: How to perform Accept and Reject User in Admin module

  1. #1
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to perform Accept and Reject User in Admin module

    hi,

    I really dont have an idea how to do this.. I have a set of users registered and on registration their details get stored in a table called "temp". then when i go for accepting or rejecting the user (in admin module), i retrieve the data from that temp table.. then my question starts here : " I want to display all the details like in a form.. I want a select box for for each of the user registered and on side of it i need a accept/reject button.. i need a form like this for all the user registrations".. a sample is shown below..

    I want the values retrieved from database to be displayed like this..

    HTML Code:
    <html>
    
    <form action="accept.php" method="post">
    <table>
    <tr>
    <td>
    Name:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    <tr>
    <td>
    reg no:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    <tr>
    <td>
    username:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    <tr>
    <td>
    password:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    
    <tr>
    <td>
    <input type="submit" value="accept" >
    </td>
    <td>
    <input type="submit" value="reject" >
    </td>
    </tr>
    </table>
    </form>
    
    
    
    <form action="accept.php" method="post">
    <table>
    <tr>
    <td>
    Name:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    <tr>
    <td>
    reg no:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    <tr>
    <td>
    username:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    <tr>
    <td>
    password:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    
    <tr>
    <td>
    <input type="submit" value="accept" >
    </td>
    <td>
    <input type="submit" value="reject" >
    </td>
    </tr>
    </table>
    </form>
    
    
    <form action="accept.php" method="post">
    <table>
    <tr>
    <td>
    Name:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    <tr>
    <td>
    reg no:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    <tr>
    <td>
    username:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    <tr>
    <td>
    password:
    </td>
    <td>
    //value retrieved from database
    </td>
    <td>
    </tr>
    
    
    <tr>
    <td>
    <input type="submit" value="accept" >
    </td>
    <td>
    <input type="submit" value="reject" >
    </td>
    </tr>
    </table>
    </form>
    
    
    .
    .
    .
    .
    .
    .
    .
    .
     this should continue upto the last row of the database table
    </html>

    Please help me how to do this... i'm totally confused with this... please help..

    thanks in advance

  2. #2
    Join Date
    Jul 2006
    Posts
    497
    Thanks
    8
    Thanked 70 Times in 70 Posts

    Default

    Why do you want multiple forms on the same page? You'll only be able to accept/reject one user per submission. I suggest this layout, where XXX should be replaced with each user's reg number.

    On accept.php, loop through $_POST. If the index matches the pattern '/^action-(\d+)$/' apply the value (Accept or Reject) to the captured DB index.
    Code:
    <html>
    
    <form action="accept.php" method="post">
    <table>
    <tr>
    <th>
    Name
    </th>
    <th>
    Reg number
    </th>
    <th>
    Username
    </th>
    <th>
    Password
    </th>
    <th>
    Action
    </th>
    </tr>
    
    <tr>
    <td>
    //value retrieved from database
    </td>
    
    <td>
    //value retrieved from database
    </td>
    
    <td>
    //value retrieved from database
    </td>
    
    <td>
    //value retrieved from database
    </td>
    
    <td>
    <select name="action-XXX">
    <option>Accept</option>
    <option>Reject</option>
    </select>
    </td>
    </tr>
    
    
    <tr>
    <td>
    //value retrieved from database
    </td>
    
    <td>
    //value retrieved from database
    </td>
    
    <td>
    //value retrieved from database
    </td>
    
    <td>
    //value retrieved from database
    </td>
    
    <td>
    <select name="action-XXX">
    <option>Accept</option>
    <option>Reject</option>
    </select>
    </td>
    </tr>
    
    
    <tr>
    <td>
    //value retrieved from database
    </td>
    
    <td>
    //value retrieved from database
    </td>
    
    <td>
    //value retrieved from database
    </td>
    
    <td>
    //value retrieved from database
    </td>
    
    <td>
    <select name="action-XXX">
    <option>Accept</option>
    <option>Reject</option>
    </select>
    </td>
    </tr>
    
    
    <tr>
    <td colspan="5" style="text-align: right;"><input type="submit" value="Submit" ></td>
    </tr>
    
    </table>
    </form>
    
    
    .
    .
    .
    .
    .
    .
    .
    .
     this should continue upto the last row of the database table
    </html>
    -- Chris
    informal JavaScript student of Douglas Crockford
    I like wikis - a lot.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •