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 8823579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:23:30+00:00 2026-06-14T06:23:30+00:00

Basically my form will have to add credits to the registered users that was

  • 0

Basically my form will have to add credits to the registered users that was checked in the table that was loaded in the page. When the user clicks the submit button, the registered users which are checked will have an additional credits. My problem is that I don’t know how to retrieve the rows that are checked in the looped table. Here is my code.

<form name="blah" method="POST" action="">
<?php
include("mysql_config.php");
// INITIAL OUTPUT WHEN THE PAGE IS LOADED
echo "<table class='sample'><tr>
<td></td>
<td><b>User ID</b></td>
<td><b>Username</b></td>
<td><b>First Name</b></td>
<td><b>Last Name</b></td>
<td><b>Credits</b></td>
</tr>";
$q = "SELECT * FROM users_credits";
$res = mysql_query($q);
$num_rows = mysql_num_rows($res);
for($i=0; $i<$num_rows; $i++){
    $db_field = mysql_fetch_assoc($res);
    $reg_id = $db_field['reg_id'];
    $credits = $db_field['credits'];
    $q2 = "SELECT username, fn, ln FROM reg_users WHERE reg_id = $reg_id";
    $res2 = mysql_query($q2);
    $db_field2 = mysql_fetch_assoc($res2);
    $username = $db_field2['username'];
    $fn = $db_field2['fn'];
    $ln = $db_field2['ln'];
    echo "<tr>
        <td><input type='checkbox' value='$i' name='add_credit'></td>
        <td>$reg_id</td>
        <td>$username</td>
        <td>$fn</td>
        <td>$ln</td>
        <td>$credits</td>
        </tr>";
}
?>
<input type="submit" name="save" value="Save" >
</form>

Thanks in advance to the persons who’ll help me. 🙂

  • 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-06-14T06:23:31+00:00Added an answer on June 14, 2026 at 6:23 am

    Please update your page as :

    <form name="blah" method="POST" action="update.php">
    <?php
    include("mysql_config.php");
    // INITIAL OUTPUT WHEN THE PAGE IS LOADED
    echo "<table class='sample'><tr>
    <td></td>
    <td><b>User ID</b></td>
    <td><b>Username</b></td>
    <td><b>First Name</b></td>
    <td><b>Last Name</b></td>
    <td><b>Credits</b></td>
    </tr>";
    $q = "SELECT * FROM users_credits";
    $res = mysql_query($q);
    $num_rows = mysql_num_rows($res);
    
        while($db_field = mysql_fetch_assoc($res))
        {
        $reg_id = $db_field['reg_id'];
        $credits = $db_field['credits'];
        $q2 = "SELECT username, fn, ln FROM reg_users WHERE reg_id = $reg_id";
        $res2 = mysql_query($q2);
        $db_field2 = mysql_fetch_assoc($res2);
        $username = $db_field2['username'];
        $fn = $db_field2['fn'];
        $ln = $db_field2['ln'];
        echo "<tr>
            <td><input type='checkbox' value='".$reg_id."' name='add_credit[]'></td>
            <td>$reg_id</td>
            <td>$username</td>
            <td>$fn</td>
            <td>$ln</td>
            <td>$credits</td>
            </tr>";
    }
    ?>
    

    Make the form action in update.php as

    <?php
    $users=$_REQUEST['add_credit'];
    
    if(is_array($users))
    {
    foreach($users as $key=>$val)
    {
    
    echo $val;
    
    }
    
    }
    ?>
    

    Here you will get the users id in array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP website and I need to add a form that will
I have a report that is basically a form with multiple empty fields and
I have a form that is basically a calculator. you can type an equation
Basically, I have a form that is handled by a CMS which I cannot
Morning All, I have a form that I am using to add multiple rows
I have an NSMutableArray that is loaded into a table view. The data in
Bit of a badly written question, but basically I have a Form for users
I have a main class(which is basically a netbeans form;drag and drop) from where
Basically I've made a form in Cakephp 2.1 with a jQuery button that appends
Basically i have a form where a studentID is inputted, i then want to

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.