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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:08:14+00:00 2026-06-10T10:08:14+00:00

I have printed the table get from database like below And my code print

  • 0

I have printed the table get from database like below
enter image description here
And my code

print "<form id='form1' name='form1' method='post' action='http://localhost/live/index.php?m=sync&a=update'>";
while($db_field = mysql_fetch_assoc($result))
{
    print "<table border=1 width=100%>";
    print "<tr><td width=5%><input name='taskid' type='text' value=".$db_field['task_id']." readonly=readonly></td>";
    /*print "<td width=10%>".$db_field['task_name']."</td>";*/
    print "<td width=5%><input name='percent' type='text' value=".$db_field['task_percent_complete']." readonly=readonly></td>";
    print "</table>";
}
print "<input name='Sync' type='submit' value='Sync' id='Sync' />";
print "</form>";
mysql_close($db_handle); /*.$db_handle */ /*<---to check the resource link and id*/
}
else{
    print"Failed" ;//.$db_handle;

So what i want to know how to parsing all the datas from the database to another page like the action i want to send, because now i just can parsing 1 data in 1 table when i click the sync button like below is my parsing code in another page
The image below is the parsing code
enter image description here

I have no idea how to display all the data in new page…it is need to use loop? im newbie, big thanks

  • 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-10T10:08:15+00:00Added an answer on June 10, 2026 at 10:08 am

    Edit based on comments below:

    For starters, in the first code, move the print "<table border=1 width=100%>"; and print "</table>"; parts outside the while loop because the table is getting generated twice as two separate tables.

    What’s happening with the current code is that the second pair of fields taskid and percent are overwriting the first because the names are the same, so you only see the second pair of values in your screenshot. You need to make the input field names an array: put square brackets [] in the name so that taskid and percent are automatically arrays in $_POST. This is what the HTML source should look like in the form:

    <input name='taskid[]' type='text' ...>
    <input name='percent[]' type='text' ...>
    

    (Or manually subscript them like taskid_0, percent_0 and taskid_1, percent_1; but then you have to decide when to stop looping or use variable variables.)

    After that, in the target page where you are processing $_POST["taskid"], it will be an array which you can access as $_POST["taskid"][0], $_POST["percent"][0] and $_POST["taskid"][1], $_POST["percent"][1]. So loop through that when updating the database and generating your 2nd html:

    print_r($_POST["taskid"]);  // verify that this is an array
    print_r($_POST["percent"]); // also an array
    $i=0;
    foreach ($_POST["taskid"] as $t) {
        // not using $t, that's just for looping convenience
        // do sql insert/update here, i'm just showing how you'd loop the array
        print "<td><input type='text' name='".$_POST["taskid"][$i]."' readonly=readonly></td>";
        print "<td><input type='text' name='".$_POST["percent"][$i]."' readonly=readonly></td>";
        $i++;
    }
    

    Hope that helps.

    Some pointers: 1. Don’t put images of your code, just paste the code. 2. The generated HTML copy-pasted (browser -> view source) is more useful than an image of the page.


    version 1:
    1. If I understand it correctly, you want to show the form on one page and when the user clicks Sync (sumbit) you want it to go to another page which will process the form?

    Use the target attribute of the <form> element (link). Like:

    <form action="form_action.php" method="post">
    

    Or,
    2. If you want to process the form first (same page) and send the user to another page:

    • send an HTTP 302 re-direct + Location header.

    • You can also set the redirect in your HTML after processing the page using:

      <meta http-equiv="Refresh" content="0; url=http://www.example.com/" />
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this array which gets the last table from a database. However the
i have checkbox list printed in one column, but i need it to print
If I have the following data that is printed seperated by tabs using print
I have a problem with JTextArea... I have a method that connect to Database
I have a table login2 in /data/data/sankalp.jain.shre/databases/loginfinal.db. The database has been created correctly which
I have function which selects data from MySQL database: function get_articles( $id ){ global
I'm trying to get Entity Framework Code First to create a database for me
I have a recruiter table in my database which has different attributes and one
I have some C# code I got from http://bytes.com/topic/c-sharp/answers/572657-net-clipboard-metafiles that copies a cell range
I have a database defined with charset utf8_general_ci and a table that should store

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.