Ask about general coding issues or problems here.
Moderators: macek, egami, gesf
by jverner » Wed Sep 26, 2012 10:03 am
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>
-
jverner
- New php-forum User

-
- Posts: 3
- Joined: Mon Sep 24, 2012 2:52 pm
by egami » Wed Sep 26, 2012 1:47 pm
Try this, may work out a bit better for you.
- Code: Select all
<?php
if (isset($_POST['pc']))
{
$pc = strip_tags($_POST['pc']);
if ($pc == 0)
{
$pcText = '<a href="http://www.yahoo.com">Yahoo.com</a>';
} else {
$pcText = '<a href="http://www.google.com">Google.com</a>';
}
echo "Website: $pcText <br/>\r\n";
} else {
echo "Sorry, PC wasn't selected. So please try again.<br/>\r\n";
}
-

egami
- php-forum GURU

-
- Posts: 2197
- Joined: Wed Oct 06, 2010 11:19 am
- Location: Happy Valley, UT
Return to PHP coding => General
Who is online
Users browsing this forum: No registered users and 2 guests