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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:53:53+00:00 2026-05-22T22:53:53+00:00

I have a part of webpage that is dynamically generated using MySQL queries: <table

  • 0

I have a part of webpage that is dynamically generated using MySQL queries:

<table id="livePlayers" cellpadding="4" align="center">
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Phone number</th>
<th>Email Address</th>
<th>Rating</th>
</tr>
<?php
  while ($currLine = @mysql_fetch_array($resultSet))
  {
    $phoneCount= "phone".$count;
    $ratingCount= "rate".$count;
?>
<tr>
<td><?php echo $currLine[1]?></td>
<td><?php echo $currLine[2]?></td>
<td><input type="text" name="<?php echo $phoneCount ?>"></td>
<td><?php echo $currLine[0]?></td>
<td><input type="text" name="<?php echo $ratingCount ?>"></td>
</tr>
<?php
    $count++;
  }
?>

</table>

As you can see, 2 fields are of input type="text". Once the user has made entries in these fields, I need to update the database table with these values on clicking Submit.

However, I don’t understand how to do this since the field name would be dynamically generated. Is there any way to update the respective rows with entered values?

  • 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-22T22:53:54+00:00Added an answer on May 22, 2026 at 10:53 pm

    The name of an input should not be generated dynamically. Instead use a constant. The dynamic value of that input should be set in the value attribute of the input.

    Example for one of your inputs:

    <input type="text" name="phone" value="<?php echo $phoneCount ?>" />
    

    You can retrieve the value by using the $_GET or $_POST arrays. Assuming your form uses the POST method you can do the following:

    $phone = $_POST['phone']; // the entered text for the phone field
    

    Now you can write your UPDATE mysql query.

    Update

    To update more than one row at the same time, use an array as POST parameter:

    <input type="text" name="phone[]" value="<?php echo $phoneCount ?>" />
    

    Retrieving $_POST['phone'] will give you an array of all rows then.

    Update 2

    To identify each row you can use hidden fields like so:

    <input type="hidden" name="id[]" value="<?php echo $id ?>" />
    

    Or you use the id as associative array key for all other input fields:

    <input type="text" name="phone[<?php echo $id ?>]" value="<?php echo $phoneCount ?>" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Ajax request that comes in to update part of the webpage.
Is there someway to have a part of the page that renders like a
In my (PHP) web app, I have a part of my site that keeps
I have a two part question Best-Practice I have an algorithm that performs some
I'm using the content query web part and have exported it to a webpart
I have a build script and as part of that script it copies a
I have several applications that are part of a suite of tools that various
when i refresh a part of a webpage that has a jquery ui button,
I have a two part problem that needs fixing. I'll try my best to
I have a webpage from the Fogbugz bug tracking system, and using a plugin

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.