For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > April 2005 > Including '?? in strings









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Including '?? in strings
MP

2005-04-24, 8:55 am

Sorry for the banal question, but I'm a newbee and I'm getting crazy. I just
need to create an Hypelink to a page, including a GET var. So I wrote
something like:
$pag='page?getvar=....'
echo '<a href=' . $pag . ' etc etc

but the '?' becames '/?'. I tried to use '\?', but no result.
What's the right syntax?

MP


Geoff Berrow

2005-04-24, 8:55 am

I noticed that Message-ID: <MEIae.1282598$35.47430335@news4.tin.it> from
MP contained the following:

> $pag='page?getvar=....'
> echo '<a href=' . $pag . ' etc etc


$pag="page.php?getvar=something";
echo "<a href=' $pag'>Link</a>";
--
Geoff Berrow 0110001001101100010000000110
0011011010110110010001101111011001110010
11
1001100011011011110010111001110101011010
11
Kevin

2005-04-24, 8:55 am

MP wrote:
> Sorry for the banal question, but I'm a newbee and I'm getting crazy. I just
> need to create an Hypelink to a page, including a GET var. So I wrote
> something like:
> $pag='page?getvar=....'
> echo '<a href=' . $pag . ' etc etc
>
> but the '?' becames '/?'. I tried to use '\?', but no result.
> What's the right syntax?
>
> MP
>
>

I use the code below quite a bit and it works fine.

$tag="<a href=\"page.php?tag=$row->tag\">Click here</a>";
echo $tag;

I am getting the GET var from an array, replace the first $row->tag with
your variable.

Good Luck

Kevin
MP

2005-04-24, 8:55 pm

Thank you all,
both solution are fine. Actually, coming from VB I'm having hard time with
quotes, var inclusion in strings, etc...

MP

"MP" <purplecat@aliceposta.it> ha scritto nel messaggio
news:MEIae.1282598$35.47430335@news4.tin.it...
> Sorry for the banal question, but I'm a newbee and I'm getting crazy. I
> just need to create an Hypelink to a page, including a GET var. So I wrote
> something like:
> $pag='page?getvar=....'
> echo '<a href=' . $pag . ' etc etc
>
> but the '?' becames '/?'. I tried to use '\?', but no result.
> What's the right syntax?
>
> MP
>



steesc@politicsofstarving.com

2005-04-25, 3:56 am

in your url

http://www.yourdomain.com/page.php?getvar=thistext



page.php

$txt = $_GET['getvar'];

echo "<a href=\"http://www.$txt.com\">$txt</a>";
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com