How come I can't get this to work, is it proper syntax?
This on the other hand does work:PHP Code:$site = checkSite(strip_tags($_GET['site']));
PHP Code:$getSite = $_GET['site'];
$site = checkSite(strip_tags($getSite));
| SitePoint Sponsor |
How come I can't get this to work, is it proper syntax?
This on the other hand does work:PHP Code:$site = checkSite(strip_tags($_GET['site']));
PHP Code:$getSite = $_GET['site'];
$site = checkSite(strip_tags($getSite));
No difference, zero, nada, nowt.
Do you have more context? Maybe produce some code to reproduce?
@AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.
Ok, think I figured out the issue.
It was in my if statement using isset().
Took that out and works with both now.
Edit: What is the difference between this:
Compared to this:PHP Code:if ($var1 && $var2 && $var3) {
}
PHP Code:if (isset($var1) && isset($var2) && isset($var3)) {
}

Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
To add to Felgall's post, maybe a quick example..
PHP Code:<?php
$var1 = 'false';
$var2 = 0;
$var3 = false;
if($var1 && $var2 && $var3)
{
#nope
}
if(isset($var1) && isset($var2) && isset($var3))
{
#yup
}
?>
@AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.
Ahh ok, I learn something new everyday.
Thanks for the help.
Bookmarks