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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:56:30+00:00 2026-06-17T23:56:30+00:00

I have a simple DB and a small table in it. This table named

  • 0

I have a simple DB and a small table in it. This table named STOCK has only one column – names of different items in a stationery.

I am dynamically generating a form in PHP-MySQL which fetches Item from STOCK (such as Pencil, Pen etc.) and displays them by using echo() function. So I have generated a form which displays Item and correspondingly an <input> text box. Upon submitting this form, how can I access all the Names and their text inputs by traversing through the $_GET array?

The dynamically generated form is:

        $res = mysql_query("SELECT * FROM Stock");

        echo "<form name='input' action='add_stock_later.php' method='get'>";
        echo "<table align='left' border='1'>
        <tr>
        <th>Item</th>
        <th>Quantity</th>
        <th>Remarks</>
        </tr>";

        while($row = mysql_fetch_array($res))
          {
            $item = $row['Item'];
            echo "<tr>";
            echo "<td>" . $item . "</td>";

            echo "<td><input type='text' name='$item'></td>";
            echo "<td><input type='text' name='Remarks'></td>";
            echo "</tr>";
          }

          echo "<tr><td></td>
        <td align='middle'><input type='submit' value='Submit'></td></tr>";


        echo "</table>";

Now in the add_stock_later.php, how can I access all these $item and it’s corresponding input without having to manually do it using $_GET['Pencil'], $_GET['Pen'] and so on.

  • 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-17T23:56:31+00:00Added an answer on June 17, 2026 at 11:56 pm

    First edit your form.

    echo "<td><input type='text' name='".$item."[quantity]'></td>";
    echo "<td><input type='text' name='".$item."[remarks]'></td>";
    

    Then use foreach().

    foreach ($_GET as $stationery => $info) {
        $stationery; // name of the stationery
        $info["quantity"]; // quantity of the stationery
        $info["remarks"]; // remarks for the stationery
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought this would be simple I have a table with the first column
I'm using sqlite for a small validation application. I have a simple one table
I have a PHP page which interacts with this small MySQL database table with
I have table defined with FlexiGrid. Call to all variables is ok. One column
I have created a small and simple android app. I tried installing it on
I have a small, simple C# application which updates an icon in the system
I have written a small makefile for a few simple C programs that compiles
I have a set of relatively simple electrical circuits. Small ones involving just resistors,
I have the following parser grammar (this is a small sample): expr: ident assignop
I have this small class called City that simply holds some information about a

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.