Comunidad de diseño web y desarrollo en internet online

Pasar variable con enlace

Citar            
MensajeEscrito el 10 Ene 2010 05:35 pm
Tengo dos links en html de esta manera:

Código HTML :

<p><a href="pagina.php?url=http://www.google.com">Enlace 1</a></p>
<p><a href="pagina.php?url=http://www.yahoo.com">Enlace 2</a></p>


y en mi pagina.php tengo

Código PHP :

<body>
<?php 
$url = $_GET['url'];

echo '<h2><center><b>$url</b></center></h2>'; 
?> 
</body>


El problema es que el echo me está devolviendo $url en lugar del nombre de la variable http://www.google.com o http://www.yahoo.com. Alguien sabe dónde está el error?. Desde ya muchas gracias.

Por Ishkandar

Claber

303 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 10 Ene 2010 07:44 pm
Cambia

Código PHP :

echo '<h2><center><b>$url</b></center></h2>';  


Por:

Código PHP :

echo "<h2><center><b>$url</b></center></h2>";  


Si utilizas comillas simples, PHP no lee el valor de la variable.

:wink:

Por Dano

BOFH

4273 de clabLevel

14 tutoriales
4 articulos
10 ejemplos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Lugar estratégico para vigilarte

firefox
Citar            
MensajeEscrito el 10 Ene 2010 08:11 pm
Amigo Dano, tal como habías previsto...funcionó.

Muchas gracias

Por Ishkandar

Claber

303 de clabLevel



Genero:Masculino  

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.