PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ianhull
Forum Contributor
Posts: 310 Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK
Post
by ianhull » Sun Aug 14, 2005 6:47 am
Hi Guys, I have a db query which works fine and creates a hyperlink for the companyname in a html table.
After clicking this link it will goto nextpage.php but I would lik ethe value of the companyname variable to be passed to the next page. can anyone please tell me what I am doing wrong?
Thanks.
Code: Select all
<?php
include_once("connect.php");
$sql = "SELECT DISTINCT status, companyname, address, phone, fax, type, postcode from companies WHERE postcode='$_REQUEST[form1]' ORDER BY postcode";
$result = mysql_query($sql)
or die ("Couldn't select $_REQUEST[form1]");
echo "
\n";
//-------------get each type ------
while ($line = mysql_fetch_array($result))
{
extract($line);
echo '<LINK REL=StyleSheet HREF="123.css" TYPE="text/css">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<th width="10%" height="23" scope="col"><div align="left"><span class="style2"></span></div></th>
<th width="55%" valign="top" background="bb.jpg" scope="col"><div align="left" class="style3 style4 style7"> <a href="nextpage.php?companyname=$_POST[companyname]"> <span class="style10">' . $companyname . '</span></div></th>
<th width="35%" scope="col"><div align="left" class="style8 style5"><strong> </strong></div></th>
</tr>
<tr>
<th height="66" scope="row"><div align="left"><span class="style2"></span></div></th>
<th valign="top" bgcolor="#F5F5F5" scope="row"><div align="left" class="style4">' . $address . '</div></th>
<th scope="row"><div align="left"> </div></th>
</tr>
<tr>
<th scope="row"><div align="left"><span class="style2"></span></div></th>
<th valign="top" scope="row"><div align="left"> </div></th>
<th scope="row"><div align="left"> </div></th>
</tr>
</table>';
}
?>
ianhull
Forum Contributor
Posts: 310 Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK
Post
by ianhull » Sun Aug 14, 2005 6:50 am
Thanks any7way guys but I have just figured it out.
Code: Select all
<?php
include_once("connect.php");
$sql = "SELECT DISTINCT status, companyname, address, phone, fax, type, postcode from companies WHERE postcode='$_REQUEST[form1]' ORDER BY postcode";
$result = mysql_query($sql)
or die ("Couldn't select $_REQUEST[form1]");
echo "
\n";
//-------------get each type ------
while ($line = mysql_fetch_array($result))
{
extract($line);
echo '<LINK REL=StyleSheet HREF="123.css" TYPE="text/css">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<th width="10%" height="23" scope="col"><div align="left"><span class="style2"></span></div></th>
<th width="55%" valign="top" background="bb.jpg" scope="col"><div align="left" class="style3 style4 style7"> <a href="nextpage.php?companyname=' . $companyname . '"> <span class="style10">' . $companyname . '</span></div></th>
<th width="35%" scope="col"><div align="left" class="style8 style5"><strong> </strong></div></th>
</tr>
<tr>
<th height="66" scope="row"><div align="left"><span class="style2"></span></div></th>
<th valign="top" bgcolor="#F5F5F5" scope="row"><div align="left" class="style4">' . $address . '</div></th>
<th scope="row"><div align="left"> </div></th>
</tr>
<tr>
<th scope="row"><div align="left"><span class="style2"></span></div></th>
<th valign="top" scope="row"><div align="left"> </div></th>
<th scope="row"><div align="left"> </div></th>
</tr>
</table>';
}
?>
Kilgore Trout
Forum Newbie
Posts: 10 Joined: Sun Oct 30, 2005 3:40 pm
Location: MI
Post
by Kilgore Trout » Mon Nov 21, 2005 12:03 am
how do I call the variable on the next page?