此页面无法正常工作localhost目前无法处理此请求

时间:2017-11-29 22:42:21

标签: php html localhost

我有这个任务,我应该打印出我在表格上的所有内容。表单本身工作正常,但我的php fil不是。

这是该文件的php部分:     

    if($_POST)
        {
            $firstName = $_POST["firstName"];
            $lastName = $_POST["lastName"];
            $areaCode = $_POST["areaCode"];
            $firstHalf = $_POST["firstHalf"];
            $secondHalf = $_POST["secondHalf"];
            $address1 = $_POST["address1"];
            $address2 = $_POST["address2"];
            $zipcode = $_POST["zipcode"];
            $state = $_POST["state"];

            echo "Name: <br/>";
            echo $firstName . " " . $lastName . "<br/>";
            echo "Phone number: " . "(" $areaCode . ")" . $firstHalf . "-" . $secondHalf . "<br/>";
            echo "Address: " . $address1 . ", " . $address2 . ", " . $state ", " . $zipcode . "<br/";
        }

    ?>

当我使用页面的php部分时,它加载正常。

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

问题出在最后一行

 echo "Address: " . $address1 . ", " . $address2 . ", " . $state ", " . $zipcode . "<br/";

.

之后,你错过了$state
 echo "Address: " . $address1 . ", " . $address2 . ", " . $state . ", " . $zipcode . "<br/";