problems with <a href="<? echo $web; ?>">Website</a>

This is a discussion on problems with <a href="<? echo $web; ?>">Website</a> within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Why oh why does my domain name become part of the link when I use the following code. <a ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-05-2007
Jen
 
Posts: n/a
Default problems with <a href="<? echo $web; ?>">Website</a>


Why oh why does my domain name become part of the link when I use the
following code.
<a href="<? echo $web; ?>">Website</a>
the variable $web is from a user input form.
Here's what the link looks like
--http://mysite.com/www.variablesite.com
All other variables display correctly in
the table including <a href="mailto:<? echo $email; ?>">E-mail</a>



TIA,
jen


Reply With Quote
  #2 (permalink)  
Old 12-05-2007
Tyrone Slothrop
 
Posts: n/a
Default Re: problems with <a href="<? echo $web; ?>">Website</a>

On Tue, 04 Dec 2007 23:35:40 -0500, Jen <jenny@8675309.com> wrote:

>
>Why oh why does my domain name become part of the link when I use the
>following code.
><a href="<? echo $web; ?>">Website</a>
> the variable $web is from a user input form.
>Here's what the link looks like
>--http://mysite.com/www.variablesite.com


If the http:// is not part of $web, the browser will assume it is a
link on your site. You should parse the user input to validate its
structure.

Reply With Quote
  #3 (permalink)  
Old 12-05-2007
Jen Knee
 
Posts: n/a
Default Re: problems with <a href="<? echo $web; ?>">Website</a>

On Tue, 04 Dec 2007 20:59:26 -0800, Tyrone Slothrop <ts@paranoids.com>
wrote:

>On Tue, 04 Dec 2007 23:35:40 -0500, Jen <jenny@8675309.com> wrote:
>
>>
>>Why oh why does my domain name become part of the link when I use the
>>following code.
>><a href="<? echo $web; ?>">Website</a>
>> the variable $web is from a user input form.
>>Here's what the link looks like
>>--http://mysite.com/www.variablesite.com

>
>If the http:// is not part of $web, the browser will assume it is a
>link on your site. You should parse the user input to validate its
>structure.

Ha! I'm a noob.. but I should have figured this one out.
Now I'm going to figure out how to parse user inputs..
don't tell me, don't tell me..I love this stuff!
thanks for the quick reponse Tyrone ;)
Reply With Quote
  #4 (permalink)  
Old 12-05-2007
asdf
 
Posts: n/a
Default Re: problems with <a href="<? echo $web; ?>">Website</a>


"Jen Knee" <jenny@8675309.com> wrote in message
news:vuccl3pmg4d6fmrav4mq9lqjoaalnef81h@4ax.com...
> On Tue, 04 Dec 2007 20:59:26 -0800, Tyrone Slothrop <ts@paranoids.com>
> wrote:
>
>>On Tue, 04 Dec 2007 23:35:40 -0500, Jen <jenny@8675309.com> wrote:
>>
>>>
>>>Why oh why does my domain name become part of the link when I use the
>>>following code.
>>><a href="<? echo $web; ?>">Website</a>
>>> the variable $web is from a user input form.
>>>Here's what the link looks like
>>>--http://mysite.com/www.variablesite.com

>>
>>If the http:// is not part of $web, the browser will assume it is a
>>link on your site. You should parse the user input to validate its
>>structure.

> Ha! I'm a noob.. but I should have figured this one out.
> Now I'm going to figure out how to parse user inputs..
> don't tell me, don't tell me..I love this stuff!
> thanks for the quick reponse Tyrone ;)


....ah the enthusiam of youth ;)


Reply With Quote
  #5 (permalink)  
Old 12-06-2007
Kim
 
Posts: n/a
Default Re: problems with <a href="<? echo $web; ?>">Website</a>

On Dec 5, 5:35 am, Jen <je...@8675309.com> wrote:
> <a href="<? echo $web; ?>">Website</a>


You dont have to echo $web like that. <?=$web?> will do the same, but
just remember thats only valid for 1 variable - nothing else.
Reply With Quote
  #6 (permalink)  
Old 12-06-2007
Michael Fesser
 
Posts: n/a
Default Re: problems with <a href="<? echo $web; ?>">Website</a>

..oO(Kim)

>On Dec 5, 5:35 am, Jen <je...@8675309.com> wrote:
>> <a href="<? echo $web; ?>">Website</a>

>
>You dont have to echo $web like that. <?=$web?> will do the same, but
>just remember thats only valid for 1 variable - nothing else.


Short open tags are not recommended.

Micha
Reply With Quote
  #7 (permalink)  
Old 12-06-2007
Guillaume BASSINET
 
Posts: n/a
Default Re: problems with <a href="<? echo $web; ?>">Website</a>

Jen a écrit :
> Why oh why does my domain name become part of the link when I use the
> following code.
> <a href="<? echo $web; ?>">Website</a>
> the variable $web is from a user input form.
> Here's what the link looks like
> --http://mysite.com/www.variablesite.com
> All other variables display correctly in
> the table including <a href="mailto:<? echo $email; ?>">E-mail</a>
>
>
>
> TIA,
> jen
>
>

else if you use <?php echo $web, ?> ??
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:43 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0