Jump to content

hyperlink in a php echo line


pouncer

Recommended Posts

[code=php:0]
function RedirectBackToLogin() {
echo "<br>You will be redirect back to the main login page in 5 seconds, or click <a href="index.html">here</a> to go back.<br>";
}
[/code]

keeps giving me error

Parse error: parse error, unexpected T_STRING, expecting ',' or ';'

and can someone show me how to make it go back to index.html after 5 seconds?
Link to comment
https://forums.phpfreaks.com/topic/26508-hyperlink-in-a-php-echo-line/
Share on other sites

You must escape double quotes within a string that's started and ended with double quotes: \"index.html\"

+ EDIT: You can use meta refresh to redirect

[code]

<?php

function RedirectBackToLogin() {
echo "<meta http-equiv=\"refresh\" content=\"5; url=index.html\" />";
echo "<br>You will be redirect back to the main login page in 5 seconds, or click <a href=\"index.html\">here</a> to go back.<br>";
}

?>

[/code]
[quote author=alpine link=topic=114199.msg464554#msg464554 date=1162939186]
You must escape double quotes within a string that's started and ended with double quotes: \"index.html\"

+ EDIT: You can use meta refresh to redirect

[code]

<?php

function RedirectBackToLogin() {
echo "<meta http-equiv=\"refresh\" content=\"5; url=index.html\" />";
echo "<br>You will be redirect back to the main login page in 5 seconds, or click <a href=\"index.html\">here</a> to go back.<br>";
}

?>

[/code]
[/quote]

Thanks Alpine, perfect. Only problem is when the word 'here' gets hyperlinked my page backgrounds are all dark colors so i can't see the word clearly.

is there a way to set the hyperlink color to white or something?

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.