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:

  1. Change your action attribute is that the posts as the correct script: action = "db.php"
  2. 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

Popular posts from this blog

sql - Find last match with latest inserted name in table -

c# - XML serialize base class without knowing derived class -

ios - Invalid IPA: missing embedded provisioning profile. Are you sure this is an ad hoc? -