php - JavaScript - Submitting to database after checking -
I have made some assumptions, so it checks whether the text field is an email address, my next task when input is correct My PHP sends data to the database in the file sends
Any ideas
JS:.? & Lt; Script & gt; Validate function () {var x = document.forms ["reg"] ["user"]. Value; Var characters = "@"; If (x.match (characters)) {Warning ("Email address can not be in the form of USERNAME!"); }} & Lt; / Script & gt;
XHTML share:
So when there is no "@" in the text field, I want the data to be sent to DB.PP ().
Any thoughts? Thank you
You need to change two things:
- Change your
action
attribute is that the posts as the correct script:action = "db.php"
-
You make a refund Boolean values from your Javascript function; When the
false
form is submitted, it will be canceled:validateForm () {var x = document.forms ["reggae"] ["user"] . value; Var characters = "@"; If (x.match (characters)) {Warning ("Email address can not be in the form of USERNAME!"); return false; } Back true; }
Comments
Post a Comment