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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:09:18+00:00 2026-06-11T09:09:18+00:00

i get data from my mysql database and want to make a list. in

  • 0

i get data from my mysql database and want to make a list.
in the list i want a button that uses post to send a value to the next page.

$result = mysql_query("SELECT * FROM all");
echo "<table border=\"1\">";
echo"<tr>
    <th>ID</th>
    <th>Naam</th>
    <th>Eigenaar</th>
    <th>Plaats</th>
    <th>Bewerk</th>
    </tr>";
    ?>
    <form action="editshop.php" method="post">
    <?php
    while($rij = mysql_fetch_array($result))
  {

    ?> 


        <?php
        echo "<tr><td>".$rij['id'] . "</td><td> " . $rij['naam'] ."</td><td>";
        echo $rij['eigenaar'] . "</td><td>" . $rij['plaats']."</td>" ;
        echo"<input type=\"hidden\" name=\"id\" value=".$rij['id']."  /><td><input type=\"submit\" /></td>";
        echo "</tr>";
    }
echo "</form></table>";

the table looks good but when i pres the button and the editshops.php opens wher i have echo $_POST["id"];
it always the last id of the list.
i only want the number thats the same as the id in the list.
in the list the id’s are shown good.
What have i done wrong
(sorry if the layout of this post is not good this is my firstpost and i dont understand how to highlight the code)
Update
changed the loop to

<?php
    while($rij = mysql_fetch_array($result))
  {

    ?> 
        <form action="bewerkshop.php" method="post">

        <?php
        echo "<tr><td>".$rij['id'] . "</td><td> " . $rij['naam'] ."</td><td>";
        echo $rij['eigenaar'] . "</td><td>" . $rij['plaats']."</td>" ;
        echo"<td><input type=\"submit\" name=\"id\" value=\"".$rij['id']."\"  /></td>";
        echo "</tr>";
    }
echo "</form></table>";

?>

all working now but the names of the buttons are the id number can i change it to edit.
so all the buttons say edit and not the id number

  • 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-11T09:09:19+00:00Added an answer on June 11, 2026 at 9:09 am

    NOTE: I’m not sure if you want to edit multiple rows with a submit or only one. My answer is only helpful for editing multiple rows.

    You’re writing an input field for each row, all with the same name. That’s the reason why the last one overwrites all the others.

    You need to name your input field accordingly.

    Example:

    <input name="naam[1]" value="..." />
    

    Where 1 here is the ID of your row.

    You can then iterate over $_POST[‘naam’] and fetch the values.

    foreach ($_POST['naam'] as $id => $value) {
        $otherValue = $_POST['otherValue'][$id];
        // ...
    
        // do something with it and add some checks if the keys exist.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get data from mysql database with the help of DataImportHandler so
I want to get data from a table in my MySQL database. $linkID =
I want to use this to get data from row out of mysql database
I retrieve data from a mysql database. I want to make this data available
How get data from mysql database? I use ASP.NET and C#.Previously, I used LINQ
I've a php function to get some data from mysql database: function get_persons() {
How do I get data from MYSQL key/value pairs into a javascript object. I
I want to get data from table in MySQL and to show it in
I am trying to make a query to get data from a database, but
I have a site that displays data on travel products from a MySQL database.

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.