Re: data from db to a page and then to another page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux