Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

PHP Variable in <a href="$url">test</a> not working

Links for php scripts

Moderators: macek, egami, gesf

PHP Variable in <a href="$url">test</a> not working

Postby makrand » Thu Jul 07, 2011 6:01 am

Code: Select all
<html>
<body>
<?
$url = 'file:///C:\inetpub\wwwroot\search.php';
?>
<a href="<? echo "$url"; ?>"><br>test<br></a>
</body>
</html>

when i run the code above, the hyperlinked text appears, but when i click on it, nothing happens :( . If i right-click and open in new tab, then the link works. :?

please let me know if i have missed out something or if i have a bug :help:
thanks in advance :D
makrand
New php-forum User
New php-forum User
 
Posts: 5
Joined: Thu Jul 07, 2011 5:46 am

Re: PHP Variable in <a href="$url">test</a> not working

Postby jorgepinho » Thu Jul 07, 2011 6:29 am

Hi,

Well, the problem here is that, calling PHP as you have will not work

PHP has to be called like: http://www.domain.com/search.php

You need a server (like apache or IIS), then configure it to run PHP scripts...

--
Jorge
Live Help on Skype: lets.talk.about.help
(languages: english, portuguese)
jorgepinho
New php-forum User
New php-forum User
 
Posts: 101
Joined: Tue Jul 05, 2011 5:41 am
Location: Portugal

Re: PHP Variable in <a href="$url">test</a> not working

Postby makrand » Thu Jul 07, 2011 6:42 am

oh alright..
i have iis 7.5 installed and php works flawlessly..
could you please give an example?
like a code or something? :oops:
makrand
New php-forum User
New php-forum User
 
Posts: 5
Joined: Thu Jul 07, 2011 5:46 am

Re: PHP Variable in <a href="$url">test</a> not working

Postby ausz99 » Thu Jul 28, 2011 2:07 am

jorgepinho wrote:Hi,

Well, the problem here is that, calling PHP as you have will not work

PHP has to be called like: http://www.domain.com/search.php

You need a server (like apache or IIS), then configure it to run PHP scripts...

--
Jorge
Live Help on Skype: lets.talk.about.help
(languages: english, portuguese)


Do you mean they just have to write

Code: Select all
$url = 'http://www.domainname.com/search.php';


rather than

Code: Select all
$url = 'file:///C:\inetpub\wwwroot\search.php';
ausz99
New php-forum User
New php-forum User
 
Posts: 10
Joined: Wed Jun 08, 2011 8:15 am


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron