how to check empty value in database and redirect

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

Post Reply
gimpact
Forum Commoner
Posts: 65
Joined: Tue Jun 16, 2009 11:08 pm

how to check empty value in database and redirect

Post by gimpact »

Hello,

I have a registration form. I should have many fields such firstname,lastname,age,address,post codes and many other but how ever, at the time of registration I would like user to enter as little data as possible. Say firstname,address,email and password will do.

Then they activate their account using activation link sent to their email.When they login for the first time, I would like them to feed remaining datas.

For this i am thinking of making the fields NULL or enter a simple value such as "nodata". Every time when the user login, I would like to check if the data in the address field is "nodata". if it is so then the user will be redirected to another page and if it is not then the user will continue using the account.

I was just wondering is there any other way to do this. This fields are imports and can not be left blank but at the same time, I dont want user to fill in when they register for the first time.

Thank you
User avatar
paqman
Forum Contributor
Posts: 125
Joined: Sun Nov 14, 2004 7:41 pm
Location: Burnaby, BC, Canada

Re: how to check empty value in database and redirect

Post by paqman »

I'd just leave the fields blank and check if $field = "". You won't have to worry about any weird problems, like if the user for some odd reason enters in 'nodata' into one of the fields.
Post Reply