is this code right? - Mysql query from select menu.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Check if that particular index of the post array is set before even displaying the result.

Code: Select all

if(isset($_POST['whatever']))
{
    // Show the results of the form
}
else
{
    // Show the form
}
If you want the form to always be shown, you can remove the else.
User avatar
ReverendDexter
Forum Contributor
Posts: 193
Joined: Tue May 29, 2007 1:26 pm
Location: Chico, CA

Post by ReverendDexter »

Is there a reason why you're using isset($_POST['whatever']) to instead of empty($_POST['whatever'])?

I ask because I had issues earlier this week using isset() instead of empty() when I was looking to see if the $_POST variable had data in it. empty() worked better for what I was doing. :shrug:

-Dex
revocause
Forum Commoner
Posts: 94
Joined: Tue May 29, 2007 9:37 am

Post by revocause »

thats awesome. it works
errors went away.

Yay .

thanks Rev and Super.
you two been the biggest help in two weeks :P

Its ok Scotty .. the engines have gone back to normal levels.. his brains not gonna blow

Thanks again.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

ReverendDexter wrote:Is there a reason why you're using isset($_POST['whatever']) to instead of empty($_POST['whatever'])?
No reason in particular, other than to familiarize him with isset(). isset() has a larger range of use than empty(), although empty() would work perfectly fine in this situation.
Post Reply