Jump to content

PHP+SQL


powaz

Recommended Posts

Hello i have problem and i can't find a decision

 

while ($row = mysql_fetch_array($query)){

 

echo '<form action="search.php" method="post"><input type="hidden" name="id" value="'.$row['ID'].'"><input type="submit" value="info"></div>';

....

how to send ID to another page, this line send only the last ID in my table, but i need 1,2.. etc. values to next page, not the last.

Please help me

 

Thanx 4 your answers.

Link to comment
https://forums.phpfreaks.com/topic/50821-phpsql/
Share on other sites

<?php
echo '<form action="search.php" method="post">';
while ($row = mysql_fetch_array($query)){
echo '<input type="hidden" name="id[]" value="'.$row['ID'].'">';
}
echo '<input type="submit" value="info"></div>';

 

That will put all ids into an array reference by $_POST['id'][0]...etc on the submitted page.

Link to comment
https://forums.phpfreaks.com/topic/50821-phpsql/#findComment-249900
Share on other sites

Are you sure the query is retreiving more than one row, view the source on the page to see what html is generated, see how many hidden fields were made.

 

 

For query i sure (7) there are, hidden fields only one. 

$i=1;

while ($row = mysql_fetch_array($uzklausa)){

<input type="hidden" name="id['.$i.']" value="'.$row['ID'].'"><input type="submit" value="info"></form>'.$row['ID'].'</td>';

echo '<td width="100"><div align="left"><img src="flags/'.$row["psalis"].'.png"> '.$row["psalis"].'</div></td>';

....

echo 'i: '.$i.'<br>';

$i++;

If i put 'i' to count these row its ok?!

but i don't know how to get 'i' in next page then  :-\

 

what the decision i don't know :(

 

maybe there some different ways to solve this problem...

i need additional information then i push "info", i need select from additional 3 tables to see all information about company and user which put this cargo information....  ???

 

Thanx form answers

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/50821-phpsql/#findComment-249942
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.