如何在PHP中形成提交/处理

时间:2015-05-15 19:07:03

标签: php forms

我已经在HTML中创建了一个表单,并希望完成提交它的完整周期并创建了一个PHP脚本。 HTML中的表单代码如下:

<form action = "script.php" method = "get">
        <br>
        username
<input
       Type = "text"
       name = "username"


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

firstname
<input 
          type = "text"
          name = "firstname" />
 Submit         
 <input 
          type = "submit"
          name = "submit" />
          </form>
</body>  
</html>

在PHP文件中我创建了以下脚本 我的问题是,在提交表单后上传我的PHP表单文件时,页面上没有显示任何内容。

       <?php
         ini_set('display_errors', 1);

 $_GET["username"]."&nbsp;".$_GET["lastname"]."&nbsp;" .$_GET["firstname"];."&nbsp";.$_GET["submit"];

        echo "thank-you for submitting this information on my website";

       ?>

2 个答案:

答案 0 :(得分:0)

试试这个script.php

print "Hello world!\n";

脚本必须以&lt; \?php开头,不带反斜杠(\)

答案 1 :(得分:0)

试试这个

 <?php

    ini_set('display_errors', 1);

    if(isset($_GET['submit']))
    {

        echo  $_GET["username"]."&nbsp;".$_GET["lastname"]."&nbsp;" .$_GET["firstname"];."&nbsp";.$_GET["submit"];


                    echo "thank-you for submitting this information on my website";
    }

     ?>
相关问题