Nevermind… haha, that was me being stupid. I got the error because i for got that in HTML you need to use full URL’s when linking to other websites. It seems to be working now
You should make sure you echo a valid url
[php]// here we check if the url starts with http:// or https://, if not we add it
$url = strpos($url, ‘http://’) || strpos($url, ‘https://’) ? $_COOKIE[‘panic’] : ‘http://’ . $_COOKIE[‘panic’];
?>
Here![/php]
wait so where do i add that?
Just add it where you want to echo the url.
if i enter “google” it brings me to url " http://localhost/<?=%20$_COOKIE[‘panic’];%20//%20here%20we%20check%20if%20the%20url%20starts%20with%20http://%20or%20https://,%20if%20not%20we%20add%20it$url%20=%20strpos($url,%20’http://’)%20||%20strpos($url,%20’https://’)%20?%20$_COOKIE[‘panic’]%20:%20’http://’%20.%20$_COOKIE[‘panic’];?>"
Paste your working code, the code I posted echoes the link itself, you weren’t supposed to add all that code inside where you are echoing the link…
Replace all of it with my code only
now its giving me another bad url “http://localhost/<br%20/><b>Notice</b>:%20%20Undefined%20variable:%20url%20in%20<b>C:/xampp/htdocs/index.php</b>%20on%20line%20<b>46</b><br%20/><br%20/><b>Notice</b>:%20%20Undefined%20variable:%20url%20in%20<b>C:/xampp/htdocs/index.php</b>%20on%20line%20<b>46</b><br%20/>”
You were supposed to replace all your code with mine…
[php] // here we check if the url starts with http:// or https://, if not we add it
$url = strpos($url, ‘http://’) || strpos($url, ‘https://’) ? $_COOKIE[‘panic’] : ‘http://’ . $_COOKIE[‘panic’];
?>
still giving the same(ish) url “http://localhost/<br%20/><b>Notice</b>:%20%20Undefined%20variable:%20url%20in%20<b>C:/xampp/htdocs/index.php</b>%20on%20line%20<b>48</b><br%20/>”
[php]<?= // here we check if the url starts with http:// or https://, if not we add it
$url = strpos($url, ‘http://’) || strpos($url, ‘https://’) ? $_COOKIE[‘panic’] : ‘http://’ . $_COOKIE[‘panic’];
?>
Here![/php]
Also it displays on my webpage this:
Notice: Undefined variable: url in C:\xampp\htdocs\index.php on line 45
Notice: Undefined variable: url in C:\xampp\htdocs\index.php on line 45
http://www.google.com Here! Here!
Why do you continue changing my code? I have posted the answer several times, just copy what I wrote (exactly), paste it, and refresh your browser. Do not change anything…
Ah, if that is your entire page then you have to have a normal php opening tag…
[php]<?php // <?= is a short echo, it can not be used as an opening tag
// here we check if the url starts with http:// or https://, if not we add it
$url = strpos($url, ‘http://’) || strpos($url, ‘https://’) ? $_COOKIE[‘panic’] : ‘http://’ . $_COOKIE[‘panic’];
?>
Here![/php]
Lol you just answered my reply that i was about to give i changed the code you gave me because it wasint open properly… or at all that is XD But im still slightly confused. That code goes at the top of the page correct? because it dosint seem to work in the middle, even when i copy and paste it exactly as you show me.
Paste the working code where you have it in the middle, I can point out the error for you…
Error displayed on page:
Notice: Undefined variable: url in C:\xampp\htdocs\index.php on line 47
Notice: Undefined variable: url in C:\xampp\htdocs\index.php on line 47
However the link is working now. SO what is causing the two messages to be displayed just below the form bar?
I don’t know, you didn’t send the code with our modification so I’m not sure how you have implemented it.
[php]<?php // <?= is a short echo, it can not be used as an opening tag
// here we check if the url starts with http:// or https://, if not we add it
(this is line 47)$url = strpos($url, ‘http://’) || strpos($url, ‘https://’) ? $_COOKIE[‘panic’] : ‘http://’ . $_COOKIE[‘panic’];
?>
Here![/php]
You don’t have 47 lines in that code
Im only copying the area around the code. ill post the whole thing.