php again.....

Soldato
Joined
6 Apr 2008
Posts
3,352
Location
Reading
Gods of php and HTML please help me!

I have a small bit of php that prints outs all 'items' in a table in nice little rows.

at the end of each row i was a view item button where the user is taken to a page with more details regarding the item inc picture. Now ive already written this its works with a singular input from a form then it fetches and displays the information based upon the primary key input.

so after each line of information i want a submit value that takes the primary key and feeds it to the other php file. ie.

------------------------------
00001 eufhuwl vwehu <SUMBIT>
------------------------------
93015 vobnorf ihvowf <SUBMIT>
------------------------------
.
.
.

I have this in the loop so the button appears where it should for each item.
how do i tell it to feed the form a variable?

echo "<form action = 'Results_item.php' method = 'POST'>";
echo "?????????";
echo "<td colspan = '2' style = 'text-align: right'>
<Input type = 'submit' value = 'View Item'>";

I dont want any text input just to feed the value in. I know this is bloody simple I just cant find it anywhere.

thanks in advance

Edd
 
you could have a hidden field in the form or add on a querystring to the form action so it would become

echo "<form action = 'Results_item.php?ID=$theID' method = 'POST'>";
 
you could just have a hidden field with the ID in such as:

echo "<input type='hidden' name='key' value='$PRIMARYKEYVALUE'>";

then on the next page:

$id = $_POST['key'];

SELECT * FROM products where id = $id;
 
Back
Top Bottom