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!
Hi guys,
Mr Newbie again
I have a set of forms and I want values to be entered into them before submitting. Is there any way, before I try to update the database, to check if the forms have something in them, and make a popup message box appear to warn if it doesn't?
Also, is it possible to test the content for the form?
Cheers and Marry Xmas to all of you!
Azhrarn
If you want popup boxes then you need to use Javascript. It's best to not rely simply on clientside validation (which can easily be turned off by users) so you'll also need to test the data using PHP. You can [php_man]trim[/php_man]() all the input,
to get rid of extra spaces, then you can use functions like [php_man]empty[/php_man]() to make sure that there is data in the field. If you need to test for a number then there are functions like [php_man]is_numeric[/php_man]() and [php_man]ctype_digit[/php_man]() that you can use.
yeah, but here is the problem:
I post in the main page and I update the database in the following page (POST from one to the other). So I want to test before posting, in such a way that someone can still edit the fields before loading the next page. Is there any way to do this, or will I at least have to reload the current page?
Cheers and thanks for all the help.
Azh