> > Thanks for the aswers, but there is still some problems. > > I tested this code(below) and it works but when I add it to the rest of my > code it stops working. > > Here's the working code: > > page1: > > <?php > $bandname = "Someband"; > ?> > <form name="goto_info" action="band_info.php" method="post"> > <input type="hidden" name="bandname" value="<?php echo $bandname; ?>"> > <a href="band_info.php?bandname=$bandname" onclick="goto_info.submit(); > return false;"><?php echo $bandname; ?></a> > </form> > > and page2: > > Bandname is <?php echo $_POST["bandname"]; ?>! > > _________________________________________________ > > Now, here's the one I've been fighting with: > > <? > include("XXXXXXX.inc.php"); > mysql_connect($host,$username,$password); > @mysql_select_db($database) or die( "Unable to select database"); > $query="SELECT * FROM band"; > $result=mysql_query($query); > > $num=mysql_numrows($result); > > mysql_close(); > > echo "<b><center>Bands</center></b><br><br>"; > > ?> > <table border="0" cellspacing="2" cellpadding="2"> > <tr> > <th><font face="Arial, Helvetica, sans-serif">bandname</font></th> > </tr> > > <? > $i=0; > while ($i < $num) { > $bandname=mysql_result($result,$i,"bandname"); > ?> > <tr> > <form name="goto_info" action="band_info.php" method="post"> > <input type="hidden" name="bandname" value="<?php echo $bandname; ?>"> > <a href="band_info.php?bandname=$bandname" onclick="goto_info.submit(); > return false;"><?php echo $bandname; ?></a> > </form> > </tr> > <? > ++$i; > } > echo "</table>"; > ?> > > For some reason this doesn't post bandname to band_info page... > Your while () { } loop looks strange to me. You are doing a SELECT * from your database and basically want to output each result with an assigned $bandname, right? If you're selecting all records, that you shouldn't need to do a row count or use the $i counter. You could simply do this: <script language="JavaScript"> <!-- function submitForm(bandname) { document.goto_info.bandname.value=bandname; document.goto_info.submit(); } //--> </script> <? include("XXXXXXX.inc.php"); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM band"; $result=mysql_query($query); mysql_close(); ?> <b><center>Bands</center></b><br><br> <form name="goto_info" action="band_info.php" method="post"> <input type="hidden" name="bandname" value=""> <table border="0" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">bandname</font></th> </tr> <? while ($row = mysql_fetch_row($result)) { $bandname=$row['bandname']; ?> <tr> <a href="javascript:submitForm('<?php echo $bandname; ?>')"><?php echo $bandname; ?></a> </tr> <? } ?> </table> </form>