我的表单似乎没有将值发送到表单操作页面。我试图将它们设置为变量,所有变量回显为未定义。我用了var_dump($ _ POST);并且它表示数组中的所有值都为null。我看过我的表格。我已经在线测试了代码以及wamp和xampp,但结果相同。如果有人能帮助我,我会非常感激。我已经为此工作了一个星期了。 这是我的表单页面hash.php:
<html>
<body>
<h2>Modal Signup Form</h2>
<button onclick="document.getElementById('id01').style.display='block'"
style="width:auto;">Sign Up</button>
<div id="id01" class="modal">
<span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
<form action="action.php" class="modal-content" method= "post">
<div class="container">
<h1>Sign Up</h1>
<p>Please fill in this form to create an account.</p>
<hr>
<label for="username"><b>Username</b></label>
<input type="text" placeholder="Check Availability" name="username" required>
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" required>
<label for="phone"><b>Phone</b></label>
<input type="tel" minlength="10" maxlength="10" placeholder="Enter 10 digit Phone number" name="phone">
<label for="psw"><b>Password</b></label> <span id = 'message'> </span>
<input type="password" pattern= "^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])(A-Za-z\d$@$!%*?&]{12,}" placeholder="Enter Password" id= "password" name="password" onkeyup='check();' required>
<label for="psw-repeat"><b>Repeat Password</b></label>
<input type="password" pattern= "^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])(A-Za-z\d$@$!%*?&]{12,}" placeholder="Repeat Password" id= "confirm-password" name="confirm-password" onkeyup='check();' required>
<div class="g-recaptcha" data-sitekey="6LeF200UAAAAAF1pKTeBDArjQ18LBh87bi4w1l1N"></div>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div class="clearfix">
<button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button>
<button type="submit" value="submit" class="signupbtn">Sign Up</button>
</div>
</div>
</label>
</form>
<script>
var check = function() {
if (document.getElementById('password').value ==
document.getElementById('confirm-password').value) {
document.getElementById('message').style.color = 'green';
document.getElementById('message').innerHTML = 'matching';
} else {
document.getElementById('message').style.color = 'red';
document.getElementById('message').innerHTML = 'not matching';
}
}
</script>
<script>
// Get the modal
var modal = document.getElementById('id01');
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>
我的表单操作是action.php:
if (isset($_POST['username']))
{
echo "IT IS SET!";
$username = $_POST['username'];
$_POST['email'] = $email;
$_POST['phone'] = $phone;
$_POST['password'] = $password;
$_POST['confirm-password'] = $confirmpassword;
}
var_dump($username);
echo $password;
echo $confirmpassword;
echo $phone;
echo $email;
echo $username;
var_dump($_POST);
答案 0 :(得分:0)
你实际上在var_dump()之前覆盖你的$ POST中的所有变量。尝试将其移至顶部。我也改变了你的任务,所以你不会覆盖他们。
while (scanf ("%d", (int)ph[i].vi.temperature) < 0) {
warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int'