There's probably a simple solution to this, I simply don't know what it is.

I'm working on a php-driven web form, information to be submitted to a database. A number of the fields on the form correspond to not null areas in the db, so I need to figure out a way to prevent the end user from leaving those areas blank.

In the past, I've run into this problem in the Delphi programming environment. There, my solution was to create a pop-up dialog box warning the user that they had to fill in the required fields, and preventing the information from processing until they had done so.

I know I can refuse to process my data in the php file, since I'm drawing it from the form's data and validating it (currently against injection attacks, more as what I need becomes clearer) before doing anything else. But the form itself is supposed to run in the background; after finishing its work, the forms are supposed to redisplay, without any delay. Having to show the warning on the page would cause a few problems, and would also tend to make it look bad, as far as I can tell.

Is there some way I can create a 'pop-up' or equivalent warning box to let the end-user know that they've neglected to fill in a required field, like I'm used to in Delphi? Or is there some other, relatively simple, measure I could use to warn them about the fields? I'm not sure that simply marking the required fields will help; I've had trouble on both sides of that issue in the past. (Marked fields that wouldn't let me enter data, and fields that were required but not obviously so on a marked field form. And, of course, simple end-user [me] situational blindness.)

Any suggestions along these lines would be greatly appreciated.

Thanks in advance,

You'll need JavaScript for this as PHP only works on the server. Once the page is loaded in the browser PHP no longer can interact with it.

Javascript is probably your best bet here. You can do non-null validation in PHP, but you run in to problems with making the user go back to the form again.

In case you are not using Dreamweaver, you will have to javascript the validation code yourself, otherwise, dreamweaver has a validation script that you can apply to any form. It is really simple to add it to any existing form.
Make sure to make the required fields clearly marked - for example add a small * near the name to indicate a required field. Users are already experienced in filling forms, so this is a sign they won't miss if seen. However you cannot rely on user's attention. That's why javascript is your best solution.

p.s. You can find a sample validation code here