FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
Checking variable types
Message  
Reply with quote
Post Checking variable types 
Lets now move on to variable types.  In other words, check the variable content to find if it is numeric or string type.  For example:

    <form>
    <INPUT name=somevar type=radio value=1>
    <INPUT name=somevar type=radio value=2>
    </form>
    
    The somevar variable is numeric. And if you have:
    
    <form>
    <INPUT name=somevar type=radio value="1">
    <INPUT name=somevar type=radio value="2">
    </form>

The somevar variable is a string.  Please note the importance of quotes.

You can check whatever is a string or an integer using is_integer(value) function that returns true if value is an integer.  For example:

    If (!is_integer($somevar)){
    echo (" Hacking Attempt ");
    exit;
    }

It is quite common to assign small integer values to your variables in a form. In this case, it is useful to check if your variable is an integer or a string. However, please notice that all variables sent using GET method are strings unlike variables sent using POST method that can be either strings or integers.


http://www.devshed.com/c/a/PHP...riables/2/

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com