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

  • Home
  • SEARCH
  • 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 8380177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:23:16+00:00 2026-06-09T16:23:16+00:00

I get the values from same row, but many values with fetch array .

  • 0

I get the values from same row, but many values with fetch array. I did it, but with buttons, as many as how many values there are. If I have 5 rows, then I should have five submits, but I want one submit button.

Here is my code:

$result2 = mysql_query ("select * from price  where dom='$cat'",$db);
        $myrow2= mysql_fetch_array($result2);

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


do {
    echo <<<here

   <td><input name="etiket[$myrow2[id]]" type="text" value="$myrow2[etiket]"/></td>
   <td><input name="pricestandart[$myrow2[id]]"  type="text" value="$myrow2[pricestandart]"/></td>
   <td><input name="number[$myrow2[id]]" type="text" value="$myrow2[number]"/></td>
   <td><input name="totalunper[$myrow2[id]]" type="text" value="$myrow2[totalunper]"  disabled="disabled"/></td>
   <td><input name="discount[$myrow2[id]]" type="text" value="$myrow2[discount]"/></td>
   <td><input name="totalwithper[$myrow2[id]]" type="text" value="$myrow2[totalwithper]" disabled="disabled"/></td>





  </tr>

here;


}

while($myrow2= mysql_fetch_array($result2)) ;

?>

<input NAME="id[]" TYPE=hidden value="<?php foreach($myrow2[id] as $mid) {print $mid;} ?> "/>   

<input name="submit" type="submit" value="Submit"/><br> 
</form>

HERE is UPDATEPAGE.php:

if (isset($_POST['etiket'])) {$etiket = $_POST['etiket']; }
if (isset($_POST['pricestandart'])) {$pricestandart = $_POST['pricestandart'];}
if (isset($_POST['number'])) {$number = $_POST['number']; }
if (isset($_POST['discount'])) {$discount = $_POST['discount']; }
if (isset($_POST['id'])) {$id = $_POST['id']; }

$totalunper=$pricestandart*$number;
$percent=$discount/100;
$totalwithper1=$totalunper*$percent;
$totalwithper=$totalunper-$totalwithper1;

foreach($id as $team_id)
{

$result = mysql_query("UPDATE price SET etiket='$etiket[$team_id]',pricestandart='$pricestandart[$team_id]',number='$number[$team_id]',totalunper='$totalunper[$team_id]',discount='$discount[$team_id]',totalwithper='$totalwithper[$team_id]' WHERE id='$team_id'");  }

How can I get values with different id‘s and update them?

  • 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-09T16:23:18+00:00Added an answer on June 9, 2026 at 4:23 pm
    <input NAME="id[]" TYPE=hidden value="<?php foreach($myrow2[id] as $mid) {print $mid;} ?> "/>
    

    is wrong. $myrow2[id] is not an array. Inside your while-loop, you should add:

    <input NAME="id[]" TYPE="hidden" value="$myrow2[id]"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get the values from a pointer to a float array, but
I want to get values from a row with the largest certain value (in
I am trying to get the values from an HTML table row. When I
Is there a better way than using globals to get interesting values from a
I have a query that returns a bunch of rows. But using the same
Getting unique rows/values in SQL. I have same some data like this valueA ValueB
I need to get summary data from many many rows. The summary fields are
I have two problems with ListView+images. I get the values for the list from
I'm trying to get values from nsdata class and doesn't work. here is my
I am trying to get values from a data set. My function has 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.