我正在尝试在一个页面中提交三个表单。但是我卡在了一点。 我想在第一个表格中验证手机号码。然后在最终表单提交中使用该手机号码
我已经尝试在单一表单中使用它,但是我如何发送网络请求以使用验证移动按钮发送验证 pin。
我有这样的三种形式,
//First Form Take Mobile Number, web service will send verification Pin as reply to this action
<form name="PhoneVerification" action="url to phone verification web service" >
Phone Number: <input type="text" name ="number" id="phone">
<input type="submit" name ="submit1" id="submit1">Verify Mibile Number</input>
</form>
//Second Form verifies pin Locally which is sent by first service
<form name="PinVerification" action="verify pin came from previous web service">
Verification Pin(Sent on Mobile Number): <input type="text" name ="pin" id="pin">
<input type="submit" name ="submit2" id="submit2">Verify Pin</input>
</form>
//Third Form Will Take Mobile Number Previously Entered. and email/password and Complete Signup
<form action="web service call to complete signup">
Email: <input type="text" name ="email" id="email">
Password: <input type="text" name ="pass" id="pass">
PasswordAgain: <input type="text" name ="passAgain" id="passAgain">
<input type="submit" name ="submit3" id="submit3">Complete Signup</input>
</form>
问题是在提交表单后刷新页面时我无法获取电话号码的值。
我阅读了一些关于使用 AJAX 的帖子,但是我如何在这种情况下使用 Ajax。 我怎样才能做到这一点。使用 AJAX,或使用 PHP。
最佳答案
Id must be unique in your html page. In above code id="phone" be present in first to forms. the second form in pinVerfication right but there is an same id = "phone" . please change it and make an another try. third form have also same problem
//Second Form verifies pin Locally which is sent by first service
<form name="PinVerification" action="verify pin">
Verification Pin(Sent on Mobile Number): <input type="text" name ="number" id="pin">
<input type="submit" name ="submit2" id="submit2">Verify Pin</input>
</form>
/Third Form Will Take Mobile Number Previously Entered. and email/password and Complete Signup
<form action="web service call to complete signup">
Email: <input type="text" name ="email" id="email">
Password: <input type="text" name ="pass" id="pass">
PasswordAgain: <input type="text" name ="passAgain" id="passAgain">
<input type="submit" name ="submit3" id="submit3">Complete Signup</input>
</form>
关于php - 来自 html 中单个页面的多个 Web 服务请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21299420/