2016-04-10 9 views
0

問題の原因は何もわかりません。私は申し込みフォームを持っており、「Complete Registration」ボタンをクリックしようとすると何も起こりません!フォームは提出されていません!これはHTMLです:フォームの入力依頼がクリックできないのはなぜですか?

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="UTF-8" name="viewport" content="width=device-width, height=device-height, initial-scale = 1"> 
     <title>Signup</title> 
     <link rel="icon" href="/images/favicon.ico" type="image/x-icon"> 
     <link rel="stylesheet" href="/styling/signupstyle.css"> 
    </head> 

    <body> 
     <div id="formdiv" method="post"> 
      <h1 id="title">Sign Up Here!</h1> 
      <form id="form" name="signupform" onsubmit="return false;"> 
       <div class="inputdiv"> 
        <label for="username">Username: </label> 
        <input name="username" type="text" maxlength="20"> 
        <span id="unamestatus"></span> 
       </div> 
       <div class="inputdiv"> 
        <label for="password">Password: </label> 
        <input type="password" name="pass1" maxlength="20"> 
       </div> 
       <div class="inputdiv"> 
        <label for="pass2">Confirm Password: </label> 
        <input type="password" name="pass2" maxlength="20"> 
       </div> 
       <div class="inputdiv"> 
        <label for="email">Email: </label> 
        <input name="email" type="text" maxlength="100"> 
       </div> 
       <div class="inputdiv"> 
        <label for="gender">Gender: </label> 
        <select name="gender""> 
         <option value=""></option> 
         <option value="m">Male</option> 
         <option value"f">Female</option> 
        </select> 
       </div> 
       <div class="inputdiv"> 
        <label for="country">Country: </label> 
        <select name="country"> 
         <?php include_once("countries.html"); ?> 
        </select> 
       </div> 
       <div> 
        <input id="submit" type="submit" name="submit" value="Complete Registration!" style="width: 40%; font-size: 25px; padding: 1% 0;"> 
       </div> 
       <div style="margin-top: 5%;"> 
        <img src="/images/ConnectionLogo.PNG" alt="Connection" style="width: 25%; height: 25%;"> 
       </div> 
      </form> 
     </div> 
    </body> 

</html> 

そして、これは、フォームのスタイリングです:

body { 
width: 100vw; 
height: 100vh; 
font-size: 25px; 
background: linear-gradient(to right, #3DCBF2 , #3DF2D4); 
overflow-x: hidden; 
overflow-y: hidden; 
} 

#formdiv { 
margin: auto; 
width: 50%; 
height: 85%; 
border: 5px solid #2A67EB; 
background-color: #37A3F0; 
position: absolute; 
top: 0; left: 0; bottom: 0; right: 0; 
} 

#form { 
width: 70%; 
margin: 0 auto; 
text-align: center; 
height: 90%; 
} 

#title { 
text-align: center; 
color: #57E7F7; 
margin-top: 1%; 
} 

#form input { 
width: 35%; 
font-size: 20px; 
background-color: #70D1FA; 
border: 3px solid #4187E8; 
color: #376BE6; 
} 

#form select { 
width: 25%; 
font-size: 20px; 
background-color: #70D1FA; 
border: 3px solid #4187E8; 
color: #376BE6; 
} 

.inputdiv { 
padding-bottom: 5%; 
} 

#form label { 
margin-right: 3%; 
color: #3544F0; 
font-weight: bold; 
} 

これはまだ終わっていないPHPですが、確かに問題を引き起こしていない。

if ($_POST['submit']) { 
// Receiving data from the form // 
$username = preg_replace('#[^a-z0-9]#i', '', $_POST['username']); 
$usercheck = mysqli_query($connection, "SELECT * FROM users WHERE username='$username'"); 
$password = mysqli_real_escape_string($connection, $_POST['pass1']); 
$passconfirm = mysqli_real_escape_string($connection, $_POST['pass2']); 
$email = mysqli_real_escape_string($connection, $_POST['email']); 
$emailcheck = filter_var($email, FILTER_VALIDATE_EMAIL); 
$emailcheck2 = mysqli_query($connnection, "SELECT * FROM users WHERE email='$email'"); 
$gender = mysqli_real_escape_string($connection, $_POST['gender']); 
$country = mysqli_real_escape_string($connection, $_POST['country']); 
// Now for the check functions // 
if ($usercheck != 0) { 
    die("Sorry, your username is already in use! Redirecting..."); 
}; 
if ($password != $passwordconfirm) { 
    die("The passwords do not match! Redirecting..."); 
}; 
if ($emailcheck != 0) { 
    die("That email is already in use! Redirecting..."); 
}; 

};

+0

コンソールレポートにすべてのエラーをしていますか? – Wowsk

+0

ページは更新されますか?ボタンはクリックできないのですか? –

答えて

2

送信アクションを明示的にキャンセルするためです。あなたはonsubmit="return false;"と言う。明示的に何もしないように指示したとき、あなたはそれが何を期待していますか?

<select name="gender""> 
    <option value=""></option> 
    <option value="m">Male</option> 
    <option value"f">Female</option> 

は次のようになります:

また、追記、あなたはいくつかのHTMLの問題を持っている

<select name="gender"> 
    <option value=""></option> 
    <option value="m">Male</option> 
    <option value="f">Female</option> 
+0

私はそれを置くことさえ忘れてしまった!そのキャッチをありがとう! –