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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:03:47+00:00 2026-06-12T01:03:47+00:00

EDIT AGAIN: NEW REVISED VERSION So I have corrected the lack of tag in

  • 0

EDIT AGAIN: NEW REVISED VERSION

So I have corrected the lack of tag in my table, I have added id’s onto my forms, I have added a hidden field to each form with the same value as the form id also (as suggested)

I was trying to modify my original if isset to include form id’s but thats where I have came a little unstuck.

As mentioned, here is the HTML that the page creates:

        <br><table border=1><tr><th>customer</th><th>product</th><th>employee</th><th>return_date</th><th>complete</th></tr><br><tr><td>marne1</td><td>basketball</td><td>user</td><td>01-10-12</td><td>        <FORM id="1" method ="post" action ="g.php">
        <input type='hidden' name='x' value='1'>
        <Input type = 'Radio' Name ='ir' value= '47'> 47        <input type="submit" name="return"/>
        </FORM>
        </td></tr><br><tr><td>marne1</td><td>basketball</td><td>user</td><td>01-10-12</td><td>      <FORM id="2" method ="post" action ="g.php">
        <input type='hidden' name='x' value='2'>
        <Input type = 'Radio' Name ='ir' value= '48'> 48        <input type="submit" name="return"/>
        </FORM>
        </td></tr><br><tr><td>marne1</td><td>basketball</td><td>user</td><td>02-10-12</td><td>      <FORM id="3" method ="post" action ="g.php">
        <input type='hidden' name='x' value='3'>
        <Input type = 'Radio' Name ='ir' value= '49'> 49        <input type="submit" name="return"/>
        </FORM>
        </td></tr><br><tr><td>marne1</td><td>basketball</td><td>user</td><td>29-09-12</td><td>      <FORM id="4" method ="post" action ="g.php">
        <input type='hidden' name='x' value='4'>
        <Input type = 'Radio' Name ='ir' value= '50'> 50        <input type="submit" name="return"/>
        </FORM>
        </td></tr><br><tr><td>marne1</td><td>basketball</td><td>user</td><td>01-10-12</td><td>      <FORM id="5" method ="post" action ="g.php">
        <input type='hidden' name='x' value='5'>
        <Input type = 'Radio' Name ='ir' value= '51'> 51        <input type="submit" name="return"/>
        </FORM>
        </td></tr><br><tr><td>marne1</td><td>basketball</td><td>user</td><td>01-10-12</td><td>      <FORM id="6" method ="post" action ="g.php">
        <input type='hidden' name='x' value='6'>
        <Input type = 'Radio' Name ='ir' value= '52'> 52        <input type="submit" name="return"/>
        </FORM>
        </td></tr><br><tr><td>marne1</td><td>basketball</td><td>user</td><td>02-10-12</td><td>      <FORM id="7" method ="post" action ="g.php">
        <input type='hidden' name='x' value='7'>
        <Input type = 'Radio' Name ='ir' value= '60'> 60        <input type="submit" name="return"/>
        </FORM>
        </td></tr><br><tr><td>marne1</td><td>basketball</td><td>user</td><td>02-10-12</td><td>      <FORM id="8" method ="post" action ="g.php">
        <input type='hidden' name='x' value='8'>
        <Input type = 'Radio' Name ='ir' value= '61'> 61        <input type="submit" name="return"/>
        </FORM>
        </td></tr><br></table> 

    <fieldset>
<legend>???</legend>
<form action="z.php" method="post">
Customer Name: <input type="text" name="ir" /> <br><br>
<input type="submit" name="return"/>
</form>

This is the PHP page that is creating this HTML (with my porly attempted form id test):

    <?php
$db_host = "localhost"; 
$db_username = "root";  
$db_pass = "usbw";  
$db_name = "test"; 
mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
mysql_select_db("$db_name") or die ("no database"); 
$result = mysql_query("SELECT * FROM rental WHERE customer = '$_POST[customer]' AND complete = '0' ") or die (mysql_error());
?> 

    <?php
    echo '<br>';
    echo '<table border=1>';
    echo '<tr><th>customer</th><th>product</th><th>employee</th><th>return_date</th><th>complete</th></tr>';
    echo "<br>";
    $x=1;
    while($row=mysql_fetch_array($result))
    {   
        echo '<tr>';
        echo '<td>';
        echo $row ['customer'];
        echo '</td><td>' ;
        echo $row ['product'];
        echo '</td><td>';
        echo $row ['employee'];
        echo '</td><td>';
        echo $row ['return_date'];
        echo '</td><td>';
        $cur_return = $row ['rental_id'];
        ?>
        <FORM id="<?php echo $x; ?>" method ="post" action ="g.php">
        <input type='hidden' name='x' value='<?php echo $x; ?>'>
        <Input type = 'Radio' Name ='ir' value= '<?php echo $cur_return ?>'> <?php echo $cur_return ?>
        <input type="submit" name="return"/>
        </FORM>
        <?php
    echo '</td></tr>'; 
    echo '<br>';
    $x++;
    }
    echo '</table>';
    ?> 

    <fieldset>
<legend>???</legend>
<form action="z.php" method="post">
Customer Name: <input type="text" name="ir" /> <br><br>
<input type="submit" name="return"/>
</form>

    <?php
    if (isset($_POST['return']))
    {
    if ($_POST['x']==1)
        {
        mysql_query("UPDATE rental SET complete = '1' WHERE rental_id = '$_POST[ir]'") or die (mysql_error());
        }   
    }
    ?>  

I really do appreciate all the help you guys are suggesting, and apologies for the time it’s taken me to get this sorted 🙂

Rich

  • 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-12T01:03:48+00:00Added an answer on June 12, 2026 at 1:03 am

    Wait wait. You have multiple rows of data here and you want to submit one specific row of data, but have it all in the same form? I’m a little confused. It looks like what you’re really looking for here is to generate a different form element for each row. But you cannot have multiple submit buttons submit different parts of the same form, that’s not how forms work. A submit button will submit all data belonging to the form.

    In that case, just move the opening form tag to the very beginning of the inside of your while loop, and move your submit button and closing form tag into the bottom of your while loop. It will generate each form and still maintain the structure of your table. But you cant have one form that submits only certain parts of itself, that goes against basic HTML principles.

    I’d strongly suggest slapping an ID on each form, for future reference and update purposes.

    Good luck.

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

Sidebar

Related Questions

Edit: You can get the full source here: http://pastebin.com/m26693 Edit again: I added some
EDIT AGAIN ... I'm just a dummy and figured it out! EDIT: So, it
EDIT: See my answer below--> I am wanting to have a view that when
Edit (updated question) I have a simple C program: // it is not important
EDIT: Simple version of the question: I want to create server variables in the
EDIT : This is just a simple example to demontrate the concern I have
EDIT AGAIN: the solution was probably different from my original question. Thanks everyone very
I have an app that allows a user to enter and edit projects in
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
EDIT: I was an idiot. I simply had an image that was vertically long,

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.