Directly upload the code:
<div > <h4>Membership registration</h4> <div class="formdiv"> <form method="post" action="?action=register" name="register" > <dl> <dt>Please fill in the following content carefully</dt> <dd class="hasspan"> username:<input type="text" name="username"> </dd> <dd class="hasspan"> password:<input type="password" name="pwd"> </dd> <dd class="hasspan"> 确认password:<input type="password" name="pwdagain"> </dd> <dd > <img src="img/face/" alt="Select avatar" > <input type="hidden" name="touxiang" value=""> <label ></label> </dd> <dd style="margin-right:120px;"> Verification code:<input type="text" name="code"> <span> <img src="" alt="code" name="code"> <a href="#code" >change one</a> </span> </dd> <dd class="btns"> <input type="button" name="submit" value="register"> <input type="button" name="quit" value="quit"> </dd> </dl> </form> </div> </div> Submit form data to this page,Below isjsdeal with /*Register form submission*/ function formDeal() { var btnSubmit = ('submit'); var formId = ('registerForm'); = function() { //The submit() method of the form cannot submit the form (); } } If form is submitted,There is a prompt message on this page if(!empty($_GET['action']) && $_GET['action'] == 'register') { echo 'You submitted the data'; exit(); }
As a result, I didn't see the prompt message after testing for a long time. I thought the code was wrong or the method was written incorrectly. I checked it carefully and confirmed that there was no error in the official results document.
() cannot submit, so I have to change the type of btnSubmit to submit for the time being
="submit"
I checked the information online, and the reasons are reduced to two points:
1. There cannot be a label with name=”submit” in the form
2. "enctype="multipart/form-data"" cannot be missing in the form
After testing, these two points are absurd and did not solve my problem (maybe my problem environment is different)
Later, I thought that the forum friends suggested that I change the ID of the registration button to name it without submitting it. After correction, the form is submitted normally and the prompt message appears.
Finally, the button's id should not be set to submit, otherwise it may cause confusion, resulting in the form's submit() method cannot submit the form. When naming IDs, it is best not to repeat the name with the existing API on the name to avoid unnecessary trouble.