Hi Everyone, I am trying to generate an error message in php.

I have two drop down boxes on a website I am helping with, One for product, One for Size.

Product is either shoes or hand bags.
Size is a drop down that has different shoe and handbag sizes, for example shoe size six, shoe size seven, hand bag small, hand bag medium etc.

At the moment, I can select a hand bag size IF I have selected to purchase a pair of shoes.

The script below is what I am working with at the moment. But the page is still updating the database and not stopping or displaying the error message on screen.

What is it that I am missing? Thanks in advance.

        if($purchasetype == "shoe") {
            if((strstr($purchasesize != "shoe"))) 
    {         
        $hint = 'Product Size Error';
        registerError( $hint, $hint, $error_title, 'Select The correct shoe Size' );        
        $b1=false;

        }
    }

I don't think this is enough code to fully explain your problem.
Is the second drop down being populated based on the value of the product drop down? If yes, and that bit is working correctly, then I don't see how selecting a handbag size after selecting 'shoes' would be possible.
It seems to me that worrying about handling that error is a mistake. You should be examining why that error is even possible to get to in the first place.

You say that the script is 'still updating the database' but with the limited info you've given I don't understand what that means. If a user selects a product and then a size the database is updated automatically? Or is this further through the process?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.