douzhenzu0247 2018-07-25 15:18
浏览 35

PHP简单帖子 - 帖子参数为空[重复]

This question already has an answer here:

I am making a simple review application. The below image is my DB schema:

enter image description here

Here is the PHP I am using to accept the post request:

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = ($_POST["name"]);
    $title1 = ($_POST["phone"]);
    $title2 = ($_POST["myphone"]);
    // check if name only contains letters and whitespace
    $image = ($_POST["stars"]);
    // check if name only contains letters and whitespace

    mysql_query("insert into `PeerReview` 
                        ( `ReviewerPhoneNumber`, `RevieweePhoneNumber`, 
                          `RevieweeName`, `Comments`, `Stars` ) 
                values ( '".$title2."', '".$title1."', '".$name."', '".$image."', '".$image."')");
    if (mysql_error()) {
        die(mysql_error());

        echo '
             <div class="post" style="border-bottom:1px black solid;">
              <h3>Thank You!</h3>
              </div>
              </body>
              </html>';
        die();
    }
}

I am using Postman to send the post request:

enter image description here

The result is a new row being added to my DB with an Auto-incremented ID, but blank values for every other column. This is incorrect because as you can see in Postman I am accurately adding the parameters. I have made many PHP applications before using this same technology stack. I would appreciate any direction.

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 关于无人驾驶的航向角
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了