SQL PHP HTML ASP JavaScript articles and free scripts to download
PHP Filter

filter_has_var

Filter_has_var function checks the variable available or not. The same result can be achived by using isset() function also but the advantage of filter_has_var is it checks the specified type of input is available or not. If we expect the variable to be available by POST method and not by GET method for form posting then the same can be checked by using filter_has_var function in PHP. Here is the syntax
bool filter_has_var(TYPE, variable_name);
Here is one example
if(filter_has_var(INPUT_GET,'book_id')){
echo "Yes true $book_id";
}else{
echo "No false $book_id";
}
The above code will display the status of book_id variable is available through GET method only.
The possible type of availability is INPUT_POST, INPUT_GET, INPUT_COOKIE, INPUT_SERVER, or INPUT_ENV
fillter_has_var is a better way than isset() function to to check the existence of a variable

Be the first to post comment on this article :


Google+
Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked



Join Our Email List
Email:  
For Email Newsletters you can trust
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer