2017-05-19 16 views
0

私はStackOverflowを初めて使用していますが、すばらしい開発者です。 自分の192.168.1.230ローカルサーバーのHTMLフォームを作成していましたが、送信ボタンをクリックするとHTMLコードでこの問題が発生しました。私はあなたが私のCSSが必要だとは思わないが、あなたがしているかどうか私に尋ねると、私はすべてのCSSコードで返信します。 PHPスクリプトでHTMLフォームが機能しない - HTML <form>

<button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Submit</button> 

<form class="form-horizontal" action="../php/search.php" method="post"> 

はその後に提出するため、あなたのボタンを変更します。

これを行う

<html> 
<head> 
<title>192.168.1.230 - Become Admin</title> 
<!-- Latest compiled and minified CSS --> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 

<!-- Optional theme --> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> 

<!-- Latest compiled and minified JavaScript --> 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 
</head> 
<form class="form-horizontal"> 
<fieldset> 

<!-- Form Name --> 
<legend style=text-align:center><br><h2><strong>192.168.1.230 - Become Admin</strong></h2><br></legend> 

<!-- Text input--> 
<div class="form-group"> 
    <label class="col-md-4 control-label" for="textinput">Full Name</label> 
    <div class="col-md-4"> 
    <input id="textinput" name="textinput" type="text" placeholder="e.g John Doe" class="form-control input-md" required=""> 

    </div> 
</div> 

<!-- Password input--> 
<div class="form-group"> 
    <label class="col-md-4 control-label" for="passwordinput">Password</label> 
    <div class="col-md-4"> 
    <input id="passwordinput" name="passwordinput" type="password" placeholder="e.g helloworld123" class="form-control input-md" required=""> 

    </div> 
</div> 

<!-- Text input--> 
<div class="form-group"> 
    <label class="col-md-4 control-label" for="email">Your Email:</label> 
    <div class="col-md-4"> 
    <input id="email" name="email" type="text" placeholder="e.g [email protected]" class="form-control input-md" required=""> 

    </div> 
</div> 

<!-- Select Basic --> 
<div class="form-group"> 
    <label class="col-md-4 control-label" for="selectbasic">Gender</label> 
    <div class="col-md-4"> 
    <select id="selectbasic" name="selectbasic" class="form-control"> 
     <option value="Male">Male</option> 
     <option value="Female">Female</option> 
     <option value="Other">Other</option> 
    </select> 
    </div> 
</div> 

<!-- Button --> 
<!-- Button --> 
<div class="form-group"> 
    <label class="col-md-4 control-label" for="singlebutton"></label> 
    <div class="col-md-4"> 
    <button id="singlebutton" name="singlebutton" class="btn btn-primary" action="../php/search.php" method="post">Submit</button> 
    </div> 
</div> 

</fieldset> 
</form> 
</html> 
+0

これは私の最新のコードです。古いコードがまだ動作しない – MRCoder5900

答えて

0

を使用しますが、代わりにボタン

<html> 
 
<head> 
 
    <title>192.168.1.230 - Become Admin</title> 
 
    <!-- Latest compiled and minified CSS --> 
 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
 

 
    <!-- Optional theme --> 
 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> 
 

 
    <!-- Latest compiled and minified JavaScript --> 
 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 
 
</head> 
 
<form class="form-horizontal" action="../php/search.php" method="post"> 
 
    <fieldset> 
 

 
     <!-- Form Name --> 
 
     <legend style=text-align:center><br> 
 
      <h2><strong>192.168.1.230 - Become Admin</strong></h2><br></legend> 
 

 
     <!-- Text input--> 
 
     <div class="form-group"> 
 
      <label class="col-md-4 control-label" for="textinput">Full Name</label> 
 
      <div class="col-md-4"> 
 
       <input id="textinput" name="textinput" type="text" placeholder="e.g John Doe" class="form-control input-md" required=""> 
 

 
      </div> 
 
     </div> 
 

 
     <!-- Password input--> 
 
     <div class="form-group"> 
 
      <label class="col-md-4 control-label" for="passwordinput">Password</label> 
 
      <div class="col-md-4"> 
 
       <input id="passwordinput" name="passwordinput" type="password" placeholder="e.g helloworld123" class="form-control input-md" required=""> 
 

 
      </div> 
 
     </div> 
 

 
     <!-- Text input--> 
 
     <div class="form-group"> 
 
      <label class="col-md-4 control-label" for="email">Your Email:</label> 
 
      <div class="col-md-4"> 
 
       <input id="email" name="email" type="text" placeholder="e.g [email protected]" class="form-control input-md" required=""> 
 

 
      </div> 
 
     </div> 
 

 
     <!-- Select Basic --> 
 
     <div class="form-group"> 
 
      <label class="col-md-4 control-label" for="selectbasic">Gender</label> 
 
      <div class="col-md-4"> 
 
       <select id="selectbasic" name="selectbasic" class="form-control"> 
 
      <option value="Male">Male</option> 
 
      <option value="Female">Female</option> 
 
      <option value="Other">Other</option> 
 
     </select> 
 
      </div> 
 
     </div> 
 

 
     <!-- Button --> 
 
     <!-- Button --> 
 
     <div class="form-group"> 
 
      <label class="col-md-4 control-label" for="singlebutton"></label> 
 
      <div class="col-md-4"> 
 
       <button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Submit</button> 
 
      </div> 
 
     </div> 
 

 
    </fieldset> 
 
</form> 
 
</html>
formタグの action & method属性を渡す必要があり、プレーンテキストでパスワードを保存しないでください

+0

ありがとうございます! – MRCoder5900

1

はあなたのformタグでこのaction="../php/search.php" method="post"を追加する必要があります次のようなサブームを確認してください:

私はあなたがパスワードフィールドを持って見
<?php 
if(isset($_POST['singlebutton'])){//name of button 
    $password = $_POST['passwordinput']; // 
    $name = $_POST['textinput']; 
    $email = $_POST['email']; 
    //etc. Remember to access the name attribute as it will contain the value from your form 
print_r($_POST);//returns associative array(key => value) 
} 

?> 

は、PHPのpassword_hash

+0

まだ動作していません: – MRCoder5900

+0

これはどのようなエラーが表示されますか?これは '../ php/search.php'が有効なパスですか? – Akintunde007

+0

はいそれは有効なパスです – MRCoder5900

0

So Working Codeありがとうございます2:

<html> 
<head> 
    <title>192.168.1.230 - Become Admin</title> 
    <!-- Latest compiled and minified CSS --> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 

    <!-- Optional theme --> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> 

    <!-- Latest compiled and minified JavaScript --> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 
</head> 
<form class="form-horizontal" action="../php/search.php" method="post"> 
    <fieldset> 

     <!-- Form Name --> 
     <legend style=text-align:center><br> 
      <h2><strong>192.168.1.230 - Become Admin</strong></h2><br></legend> 

     <!-- Text input--> 
     <div class="form-group"> 
      <label class="col-md-4 control-label" for="textinput">Full Name</label> 
      <div class="col-md-4"> 
       <input id="textinput" name="textinput" type="text" placeholder="e.g John Doe" class="form-control input-md" required=""> 

      </div> 
     </div> 

     <!-- Password input--> 
     <div class="form-group"> 
      <label class="col-md-4 control-label" for="passwordinput">Password</label> 
      <div class="col-md-4"> 
       <input id="passwordinput" name="passwordinput" type="password" placeholder="e.g helloworld123" class="form-control input-md" required=""> 

      </div> 
     </div> 

     <!-- Text input--> 
     <div class="form-group"> 
      <label class="col-md-4 control-label" for="email">Your Email:</label> 
      <div class="col-md-4"> 
       <input id="email" name="email" type="text" placeholder="e.g [email protected]" class="form-control input-md" required=""> 

      </div> 
     </div> 

     <!-- Select Basic --> 
     <div class="form-group"> 
      <label class="col-md-4 control-label" for="selectbasic">Gender</label> 
      <div class="col-md-4"> 
       <select id="selectbasic" name="selectbasic" class="form-control"> 
      <option value="Male">Male</option> 
      <option value="Female">Female</option> 
      <option value="Other">Other</option> 
     </select> 
      </div> 
     </div> 

     <!-- Button --> 
     <!-- Button --> 
     <div class="form-group"> 
      <label class="col-md-4 control-label" for="singlebutton"></label> 
      <div class="col-md-4"> 
       <button id="singlebutton" name="singlebutton" class="btn btn-primary" type="submit">Submit</button> 
      </div> 
     </div> 

    </fieldset> 
</form> 
</html> 

ありがとうございます!

関連する問題