Jump to content

How To Echo Hyperlinks?


jverner

Recommended Posts

When I run this, the hyperlink comes out in text. How do I make the hyperlink come out live?

 

<?php>

 

$pc = $_POST['pc'];

 

If ($pc == 0) {

$pcText = "http://www.yahoo.com";

}

 

else if ($pc == 1) {

$pcText = "http://www.google.com";

}

 

?>

 

<p>Website: <?php echo $pcText ?> </p>

Link to comment
https://forums.phpfreaks.com/topic/268834-how-to-echo-hyperlinks/
Share on other sites

This should be in the PHP section, not HTML. but just edit your code a little....

 

<?php
$pc = $_POST['pc'];
If ($pc == 0) {
$pcText = "<a href=\http://www.yahoo.com\">SomeText</a>";
}
else if ($pc == 1) {
$pcText = "<a href=\"http://www.google.com\">SomeText</a>";
}
?>

<p>Website: <?php echo $pcText ?> </p>   

  • 2 weeks later...
  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.