powaz Posted May 10, 2007 Share Posted May 10, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/50821-phpsql/ Share on other sites More sharing options...
trq Posted May 10, 2007 Share Posted May 10, 2007 echo '<form action="search.php" method="post"><input type="hidden" name="id[]" value="'.$row['ID'].'"><input type="submit" value="info"></div>'; The id's will then show up in the array $_POST['id'] on the search.php page. Quote Link to comment https://forums.phpfreaks.com/topic/50821-phpsql/#findComment-249898 Share on other sites More sharing options...
per1os Posted May 10, 2007 Share Posted May 10, 2007 <?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. Quote Link to comment https://forums.phpfreaks.com/topic/50821-phpsql/#findComment-249900 Share on other sites More sharing options...
powaz Posted May 10, 2007 Author Share Posted May 10, 2007 i wrote as you say ... $_POST['id'][0] '0' showing id 1, but if wrote ..[1] shows = nothing. if $_POST['id'] and then echo it show: ID:'array'; ??? :-\ Quote Link to comment https://forums.phpfreaks.com/topic/50821-phpsql/#findComment-249921 Share on other sites More sharing options...
per1os Posted May 10, 2007 Share Posted May 10, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/50821-phpsql/#findComment-249926 Share on other sites More sharing options...
powaz Posted May 10, 2007 Author Share Posted May 10, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/50821-phpsql/#findComment-249942 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.