pouncer Posted November 7, 2006 Share Posted November 7, 2006 [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 errorParse 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 More sharing options...
alpine Posted November 7, 2006 Share Posted November 7, 2006 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]<?phpfunction 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] Link to comment https://forums.phpfreaks.com/topic/26508-hyperlink-in-a-php-echo-line/#findComment-121241 Share on other sites More sharing options...
freakus_maximus Posted November 7, 2006 Share Posted November 7, 2006 try wrapping your echo in ()[code]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] Link to comment https://forums.phpfreaks.com/topic/26508-hyperlink-in-a-php-echo-line/#findComment-121242 Share on other sites More sharing options...
trq Posted November 7, 2006 Share Posted November 7, 2006 [quote]try wrapping your echo in ()[/quote]Why? echo is not a function! Link to comment https://forums.phpfreaks.com/topic/26508-hyperlink-in-a-php-echo-line/#findComment-121248 Share on other sites More sharing options...
pouncer Posted November 7, 2006 Author Share Posted November 7, 2006 [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]<?phpfunction 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? Link to comment https://forums.phpfreaks.com/topic/26508-hyperlink-in-a-php-echo-line/#findComment-121249 Share on other sites More sharing options...
alpine Posted November 7, 2006 Share Posted November 7, 2006 <a href=\"index.html\" style=\"color:#ffffff\">here</ a> Link to comment https://forums.phpfreaks.com/topic/26508-hyperlink-in-a-php-echo-line/#findComment-121252 Share on other sites More sharing options...
pouncer Posted November 7, 2006 Author Share Posted November 7, 2006 awesome. thanks Link to comment https://forums.phpfreaks.com/topic/26508-hyperlink-in-a-php-echo-line/#findComment-121255 Share on other sites More sharing options...
freakus_maximus Posted November 7, 2006 Share Posted November 7, 2006 Thorpe - Your right, I was looking at the actual error though when I wrote that.[quote]Parse error: parse error, unexpected T_STRING, expecting ',' or ';'[/quote] Link to comment https://forums.phpfreaks.com/topic/26508-hyperlink-in-a-php-echo-line/#findComment-121256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.