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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:34:46+00:00 2026-05-26T08:34:46+00:00

Hello i have a html form in side php everything is working fine and

  • 0

Hello i have a html form in side php everything is working fine and i have just been showed how to do hidden fields from this website.

I have a submit button on each and every result letting the user pick what they want. When they press the submit button i want the info to be submitted and added to the database. But for some reason when the user click submit on item 1 it adds the last item into the database e.g item 6 ?? So there is 6 results and a submit button for each one so 6 buttons. When the user presses submit on number 1 item it submits number 6 for some resson.

<form method="post" action="buydo.php">
                <label><br />
                <br />
                </label>
                <p>


                <?php   
    $sql = "SELECT * FROM sell
             ORDER BY Pokemon_level ASC";
    $res = mysql_query($sql) or die(mysql_error());

        while ($v = mysql_fetch_array($res)) {
            echo '
                <div class="auction_box">
                <img src="http://myrpg.net/new_rpg/'.$v['Pokemon_pic'].'" width="100" height="100"><br/>
                &pound;'.$v['price'].'<br/>
                <label id="pokemonName'.$v['id'].'">'.$v['pokemon_name'].'</label><br/>


                <label>Level '.$v['Pokemon_level'].'</level><br/>
                <label>Exp '.$v['exp'].'</level><br/>
                <label>Time Left:';

                echo '</label>
                <br/>
                <input type="hidden" name="Name" value="'.$v['pokemon_name'].'">
                <input type="hidden" name="level" value="'.$v['Pokemon_level'].'">
                <input type="hidden" name="vid" value="'.$v['id'].'">
                <input type="hidden" name="price" value="'.$v['price'].'">
                <input type="hidden" name="exp" value="'.$v['exp'].'">


                <input type="submit" id="'.$v['id'].'" class="buy_submit" value="Buy Now" /> </div>';
        }

?>



                &nbsp;</p>
                <p>&nbsp;</p>
              </form>

That is the select with the submit buttons for each result.
Then i insert the info they have chosen.

include 'config.php';
session_start() ;

$name = mysql_real_escape_string($_POST['Name']);
$Pokemon_level = mysql_real_escape_string($_POST['level']);
$idofpokemonsell = mysql_real_escape_string($_POST['vid']);
$price = mysql_real_escape_string($_POST['price']);
$exp = mysql_real_escape_string($_POST['exp']);


    $sql = "SELECT * FROM `users` WHERE `username` = '" . $_SESSION['username'] . "'";
    $result = mysql_query($sql) or die(mysql_error());
    $values = mysql_fetch_array($result);


echo $values['money'] ;




if ( $values['money'] == $price ) {
    echo "Give them the pokemon yay";
}



if ( $values['money'] > $price ) {

mysql_query("INSERT INTO `user_pokemon` (`pokemon`, `belongsto`, `exp`, `slot`, `level`) VALUES ('$name','" . $_SESSION['username'] . "','$exp','0','$Pokemon_level')") or die(mysql_error());  

    echo "Your money is over";
}

Like i say the insert only inserts item 6 no matter if u press item 1 – 5 it inserts 6 the level , exp, name everything of item 6

  • 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-26T08:34:47+00:00Added an answer on May 26, 2026 at 8:34 am

    Since you display it all in one form, the latest values are overwriting the earlier ones. Try making each item its own form by moving your <form> and </form> tags inside your while loop

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have a jsp with an html form. I set the content type
Hello i have an html form and i'm posting data but i'm unable to
For example, I have a HTML form with several input buttons, <form action=/index.php method=post>
I'm working on a simple JavaScript validation function for a html form, but have
Hello I have an edit item form. From this view, look at item.current_item_status_date .
I have the following HTML: <div class=form-square> <div class=seven-col> Hello World! </div> </div> And
Hello I have been recently working on Django search forms recently and have tired
I am following this tutorial https://developer.android.com/guide/tutorials/views/hello-tabwidget.html and have completed it. Now I would actually
This is the HTML: <div id=testBlue> <span>hello</span> <span id=testGreen class=testGreen>hello2</span> </div> If I have
Hello I have been having trouble with this for a while now. I have

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.