RE: [PHP] Adding Querystrings to links
| From: | Rance Hall | Date: | Mon, 08 Apr 2002 15:27:58 +0000 |
| Subject: | RE: [PHP] Adding Querystrings to links | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-92065@lists.php.net to get a copy of this message | ||
you want to try a code line like this
print "<a
href=\"yourpagehere.phtml?dest=$line[index]&item=$line[index2]\">LinkName</a>";
it will only work of course if you are in the middle of a loop that processes the results of an
appropriate select statement that pulls the needed values for your dest and item variables.
for a similar project I wrote this:
for ($i=0; $i < $rowcount; $i++) {
$line = mysql_fetch_array($results);
if ($i % 2) {
print "<tr bgcolor=\"white\">\n";
}
else {
print "<tr bgcolor=\"#e0e0e0\">\n";
}
print "<td><a
href=\"project_details.phtml?project=$line[pk]\">$line[projectname]</a></td>\n";
print "<td>$line[projectcustomer]</td>\n";
print "<td>$line[projectstatus]</td>\n";
print "<td>$line[projectcompletion]%</td>\n";
print "</tr>\n";
}
Hope it helps
Rance Hall
308.238.2455
Internal Office Extensions: 2455 or 6655
PC Programmer, The Buckle, Inc.
rance.hall@buckle.com
-----Original Message-----
From: mail@struempf.com [mailto:mail@struempf.com]
Sent: Monday, April 08, 2002 10:12 AM
To: php-general@lists.php.net
Subject: [PHP] Adding Querystrings to links
Hi all!
I have a problem with the querystring.I want to add to every Link on my Homepage a querystring, but
i should have the possibility to change some details in the Querystring.
How should i solve this problem ?
Example :
http://domain.com/index.php?dest=12&item=2
The variables "?dest=" and "&item=" should be in every Link on my site.But
only the values "12" and "2" should be alterable.
Thank you,and sorry for my bad english
Chris