2016-04-02 8 views
0

私はPHPの初心者です。私の 'learn.php'コードが正しく動作していません。私はPOSTフィールドにいくつかの問題があると思う。 私はWebMatrixを使用しているので、何か助けていただければ幸いであり、PHP用の良いデバッガを提案してください。 マイindex.phpをファイル:PHPコードが機能していませんか?

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8" /> 
     <title>Information Gethering</title> 

    </head> 
    <body> 
    <h1>Welcome TO my Portal login</h1> 
     <form action="learn.php" method="post"> 
     First name: <br> 
      <input type="text" name="firstname"><br> 
     Last name:<br> 

     <input type="text" name="lastname"><br> 

    Age: <br> 

      <input type="text" name="age"><br> 
      <input type="submit" value="Submit"> 
     </form> 
    </body> 
</html> 

Learn.phpファイル:

<!DOCTYPE html> 

<html lang="en"> 
    <head> 
     <meta charset="utf-8" /> 
     <title>Welcome Guest!</title> 
    </head> 
    <body> 
     <?php 
     echo" <p>You are logged In Gust!</p>";  
     $firstname=$_POST['firstname']; 
     $lastname=$_POST['lastname']; 
     $age=$_POST['age']; 

     echo'<p> your details are as: </p>'; 
     echo $name. 'CEO' </br>; 
     echo $last. 'WTF?' </br>; 
     echo $age. 'Cool' </br>; 

     ?> 

    </body> 
</html> 
+1

あなたの変数を忘れているエラーとは何ですか? – Mattia

+0

lern.phpは空のページを返します –

+3

error_reporting(E_NOTICE)を使用して、初期化されていない変数や変数名のスペルミスを簡単にチェックできます。 – Mattia

答えて

0

あなたは

<!DOCTYPE html> 

<html lang="en"> 
    <head> 
     <meta charset="utf-8" /> 
     <title>Welcome Guest!</title> 
    </head> 
    <body> 
     <?php 
     echo "<p>You are logged In Gust!</p>";  
     $firstname = $_POST['firstname']; 
     $lastname = $_POST['lastname']; 
     $age  = $_POST['age']; 

     echo '<p> your details are as: </p>'; 
     echo $firstname. 'CEO <br>';//changed $name + took </br> in comma + replaced </br> with <br> 
     echo $lastname. 'WTF? <br>';//changed $last 
     echo $age. 'Cool <br>'; 

     ?> 

    </body> 
</html> 
+0

ありがとう、使用するデバッガは? –

+0

私はそれらを必要としませんでした。ブラウザは私のためにこれを行います... –

+0

エラー報告を有効にする必要があります。それはブラウザにPHPエラーを表示します。このタグをファイルの先頭に追加する<?php error_reporting(-1); ?>。エラー報告の詳細については、http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-displayおよびhttp://php.net/manual/en/function.errorを参照してください。 -reporting.php – Liren

関連する問題