I have a PHP/mySQL script with which I can add/delete/update the entries name and email.I plan to use this for my site to add the names and email addresses of visitors to my site to my database
The script works fine with regard to creation of the tables in my db and adding/deleting records(a very simple script that can be found in most tutorial sites using PHP/mySQL).
I have a few questions:
(a)How do I validate the form entries for the name and email addresses added in the relevant boxes in the form.I want the form to recognize an invalid entry for an email address(eg,if someone uses #,$,%,,&,*,(,),+,=,|,\,[,],{,},etc in the email address input or enters the email address without the @ sign or fails to add the domain extension .com,.net,.uk,.org,etc or provides an email address starting with a number).Nothing much can be done about the name though.
(b)How do I make the email field "REQUIRED"?That is,if the visitor chooses to input this form,what do I add to this basic script that instructs to echo an error message if the email field is left blank or is filled in the manner mentioned in (a)?
(c)How must this basic script be in order to detect if the email address entered is already in my database/That is,if a visitor enters the same email address already registered I want the script to echo that this email address is already in the database or if he chooses to delete twice,I want the script to echo the script to echo that the email address does not exist in the database.How do I make the script to check the new entry against all others in the db and echo the desired result?
I'm only a beginner-level PHP/mySQL programmer and so I don't know how to work this script.There are plenty of complete scripts available at some resources,but modifying them to suit my purpose is proving to be tiresome.So I intend to use this simple insert/update/delete script with the above-mentioned validation parts added to it,if someone can come to my assistance.
If someone can even provide me the complete script with these validation aspects included,you can pl email it to <ksureshkumar@fastmail.fm> if the space in this forum proves to be restrictive.