I have created a php/html based form that inserts data into a MySQL database. However, I need to add something that will prevent an empty row from being created. In other words, if I leave the form blank and hit submit, I dont want it to insert just an empty row. Suggestions?
Right .. probably the easiest way is to use a javascript form/field validation that checks if the fields length = 0 or not before it is submitted .. there are tons of free javascript examples on the net to do this best, Jan
I'm not sure on your setup but you can validate using php. If you are posting the form using POST then just check each field isn't empty using ; if ($_POST['fieldname'] == "" || $_POST['fieldname2'] == "" ){ echo "Error Message"; } PHP: