News:

Join the Facebook Fan Page.

Main Menu

Checking Decimal

Started by mickjav, June 24, 2023, 12:40:54 PM

Previous topic - Next topic

mickjav

I have this code that checks for a number, but I need it to check for a Decimal as the amount could be like 2.50 which Int always rounds down.

Googles no help lol

if (!empty($_REQUEST['amount']))
            $pledge =  (int) $_REQUEST['amount'];
        else
            $pledge = 0;

        // Got a track?
        if (empty($pledge))
            fatal_error($txt['pledges_currency_format'], false);

Any help would be appreciated

mick



vbgamer45

Use (float) instead of (int)
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

mickjav

I really need to learn how to spell, I tried floot  :o

Thanks



Advertisement: