在添加多个div后,表单未提交......
另一个文档中使用的相同PHP代码运行良好,从一个简单的教程下载,但当我添加自定义div / CSS时,它停止工作。
我忽视了什么吗?我已经尝试将表单标签放在不同的位置,但它仍然无效。
因为我刚接触编码,所以真的很令人沮丧。
<body>
<div class="cont">
<div class="demor">
<div class="login">
<div class="avatar"><img class="img" src="./afb/avatar.png"></div>
<div class="login__formr">
<form action="login.php" method="post">
<div class="login__row">
<svg class="login__icon name svg-icon" viewBox="0 0 20 20">
<path d="M0,20 a10,8 0 0,1 20,0z M10,0 a4,4 0 0,1 0,8 a4,4 0 0,1 0,-8" />
</svg>
<input type="text" name="username" class="login__input name" placeholder="Gebruikersnaam" required/>
</div>
<div class="login__row">
<svg class="login__icon pass svg-icon" viewBox="0 0 20 20">
<path fill="none" d="M17.051,3.302H2.949c-0.866,0-1.567,0.702-1.567,1.567v10.184c0,0.865,0.701,1.568,1.567,1.568h14.102c0.865,0,1.566-0.703,1.566-1.568V4.869C18.617,4.003,17.916,3.302,17.051,3.302z M17.834,15.053c0,0.434-0.35,0.783-0.783,0.783H2.949c-0.433,0-0.784-0.35-0.784-0.783V4.869c0-0.433,0.351-0.784,0.784-0.784h14.102c0.434,0,0.783,0.351,0.783,0.784V15.053zM15.877,5.362L10,9.179L4.123,5.362C3.941,5.245,3.699,5.296,3.581,5.477C3.463,5.659,3.515,5.901,3.696,6.019L9.61,9.86C9.732,9.939,9.879,9.935,10,9.874c0.121,0.062,0.268,0.065,0.39-0.014l5.915-3.841c0.18-0.118,0.232-0.36,0.115-0.542C16.301,5.296,16.059,5.245,15.877,5.362z"></path>
</svg>
<input type="text" name="email" class="login__input name" placeholder="E-mail" required/>
</div>
<div class="login__row">
<svg class="login__icon pass svg-icon" viewBox="0 0 20 20">
<path d="M0,20 20,20 20,8 0,8z M10,13 10,16z M4,8 a6,8 0 0,1 12,0" />
</svg>
<input type="password" name="password" class="login__input pass" placeholder="Wachtwoord" required/>
</div>
<div class="login__row">
<svg class="login__icon pass2 svg-icon" viewBox="0 0 20 20">
<path d="M10.219,1.688c-4.471,0-8.094,3.623-8.094,8.094s3.623,8.094,8.094,8.094s8.094-3.623,8.094-8.094S14.689,1.688,10.219,1.688M10.219,17.022c-3.994,0-7.242-3.247-7.242-7.241c0-3.994,3.248-7.242,7.242-7.242c3.994,0,7.241,3.248,7.241,7.242C17.46,13.775,14.213,17.022,10.219,17.022 M15.099,7.03c-0.167-0.167-0.438-0.167-0.604,0.002L9.062,12.48l-2.269-2.277c-0.166-0.167-0.437-0.167-0.603,0c-0.166,0.166-0.168,0.437-0.002,0.603l2.573,2.578c0.079,0.08,0.188,0.125,0.3,0.125s0.222-0.045,0.303-0.125l5.736-5.751C15.268,7.466,15.265,7.196,15.099,7.03"></path>
</svg>
<input type="password" name="cpassword" class="login__input pass" placeholder="Bevestig uw wachtwoord" required/>
</div>
<button type="submit" name="register" class="login__submit_r">Registreren</button>
<p class="login__signup">Terug naar het <a href="login.php">Loginscherm</a></p>
</form>
</div>
</div>
</div>
</div>
<?php
if(isset($_POST['register'])){
@$username=$_POST['username'];
@$password=$_POST['password'];
@$cpassword=$_POST['cpassword'];
@$email=$_POST['email'];
if($password==$cpassword){
$query = "select * from userinfotbl where username='$username'";
//echo $query;
$query_run = mysqli_query($con,$query);
//echo mysql_num_rows($query_run);
if($query_run){
if(mysqli_num_rows($query_run)>0){
echo '<script type="text/javascript">alert("This Username Already exists.. Please try another username!")</script>';
}
else{
$query = "insert into userinfotbl values('$username','$password', '$email')";
$query_run = mysqli_query($con,$query);
if($query_run){
header( "Location: homepage.php");
}
else{
echo '<p class="bg-danger msg-block">Registration Unsuccessful due to server error. Please try later</p>';
}
}
}
else{
echo '<script type="text/javascript">alert("DB error")</script>';
}
}
else{
echo '<script type="text/javascript">alert("Password and Confirm Password do not match")</script>';
}
}
else{}
?>
</body>
答案 0 :(得分:0)
您是否尝试过<form action="login.php" method="submit">?
和迈克有关于缩进的重点。