Make sure user inputs a denomination of 500

Posted on 2012-08-24
Last Modified: 2012-08-24

I have a field which a user will fill out to bid on an item, however I need what they enter to be a denomination of 500.

At the moment I have it working so that the amount the user enters has to be more than the current bid amount in the database.

if ($amount > $row_RSproperty['propCurrBid'])

Open in new window

How do I go about making sure what they put is a denomination of 500?


Question by:djfenom
    LVL 11

    Accepted Solution

    Simple. Use the mod operator to check if there is a remainder like this:

    if ($amount > $row_RSproperty['propCurrBid'] and $amount % 500 == 0)

    Author Comment

    I knew it would be simple!



    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Join & Write a Comment

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now