PDA

View Full Version : PHP form email - required fields


mek113
12-09-2008, 11:50 PM
Used the "PHP to send form results in an email" tutorial provided on this site. Set fields to all be required entry. Tested it and if a field is not filled in, when the submit button is hit, it just goes to a blank page that says "name missing" (for example). I've seen websites that show red astericks to indicate which fields were filled in incorrectly or not filled in at all. Is a form that does that something other than PHP code? It just isn't very user-friendly if user doesn't fill in the fields correctly.

mek113

edbr
12-10-2008, 01:21 AM
you would need to use javascript to validate before server side validation

mek113
12-11-2008, 02:00 AM
Well, I don't know javascript so I guess I'm out of luck.

mek113

edbr
12-11-2008, 02:25 AM
i am pretty sure you would find a script for this if you searched somewhere like hotscipts or the like, worth a yahoogle i would think

domedia
12-11-2008, 05:11 AM
If you have PHP return the page instead of validating with JS, you could add a custom CSS class to the fields label that is not filled right.

edbr
12-11-2008, 06:57 AM
you could with some if conditions, but it would still have to go to the 'action page unless it was server self i suppose. I thought he was trying to avoid the server side validation and warn on the same page in which case javascript would alert the user immediately of course.

mek113
12-11-2008, 09:03 PM
Thanks for the feedback but you are both talking way over my knowledge base. I'll do some searching to see what I can find out.

mek113