By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,825 Members | 1,429 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,825 IT Pros & Developers. It's quick & easy.

conditonal link for each row?

P: n/a
I have a php page that displays some results, and contains a button with
each row (record) that links to a more detailed page. The typical usrl for
this button link is

/php/template1.php?searchid=497

I am looking at how I can include a conditional statement to allow me to go
to another template provided the user has a condition that I'm looking for
i.e.
everyone gets the a link to template1.php?searchid=whatever theirs' happens
to be, unless a condition is met, that would then say link to
template2.php?searchid=whatever their id is.
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
entoone wrote:
everyone gets the a link to template1.php?searchid=whatever theirs' happens
to be, unless a condition is met, that would then say link to
template2.php?searchid=whatever their id is.


<?php
if ($condition) $url = 'template2.php?searchid=whatever';
else $url = 'template1.php?searchid=whatever';
echo '<a href="', $url, '">whatever</a>';
?>

Easy, don't you think?

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2

P: n/a
Yup.. thanks. I found another way too. I do appreciate your time to respond.
"Pedro Graca" <he****@hotpop.com> wrote in message
news:c4*************@ID-203069.news.uni-berlin.de...
entoone wrote:
everyone gets the a link to template1.php?searchid=whatever theirs' happens to be, unless a condition is met, that would then say link to
template2.php?searchid=whatever their id is.


<?php
if ($condition) $url = 'template2.php?searchid=whatever';
else $url = 'template1.php?searchid=whatever';
echo '<a href="', $url, '">whatever</a>';
?>

Easy, don't you think?

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :

Jul 17 '05 #3

P: n/a
On Thu, 01 Apr 2004 08:23:46 +0000, Pedro Graca wrote:
entoone wrote:
everyone gets the a link to template1.php?searchid=whatever theirs' happens
to be, unless a condition is met, that would then say link to
template2.php?searchid=whatever their id is.


<?php
if ($condition) $url = 'template2.php?searchid=whatever';
else $url = 'template1.php?searchid=whatever';
echo '<a href="', $url, '">whatever</a>';
?>

Easy, don't you think?


Would be even easier without the first ;
;-)
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.