Folks,
Why I get this error:
**
Notice: Undefined variable: current_url in C:xampphtdocsTemplatesvalidate_current_url.php on line 31
NOTE:
Current Url is:
[code]
<?php
function fetch_current_url($data=NULL)
{
//FETCH URL
if(isset($SERVER[‘HTTPS’]) && $SERVER[‘HTTPS’] === ‘on’)
{
$url = “https://”;
}
else
{
$url = “http://”;
}
// Append the host(domain name, ip) to the URL.
$url.= $_SERVER[‘HTTP_HOST’];
// Append the requested resource location to the URL
$url.= $_SERVER[‘REQUEST_URI’];
return $url; echo ‘<br>’;
echo ‘<b>’ .__LINE__ .'</b>’; echo ‘<br>’;
}
echo $current_url = fetch_current_url();
function validate_url_with_query_string($data=NULL)
{
if(filter_var($current_url, FILTER_VALIDATE_URL) && filter_var($current_url, FILTER_VALIDATE_URL, FILTER_FLAG_QUERY_REQUIRED))
{
echo ‘Valid Url with Query String!’;
}
}
How to fix it ? Write what on which line ?
Just need the code to check the url first. Then check if the url contains a query or not. If so then show echo. Else not.