dry18813 2017-04-14 19:30
浏览 47
已采纳

PHP文件无法从index.html获取$ _POST数据[重复]

This question already has an answer here:

I'm making a simple email contact form for my website.

this is how the files are structured:

---- My_Website
         |
         |__ index.html
         |
         |__ assets
                |
                |__ email.php

in the index.html, I have a form with "POST":

<form role="form" action="assets/email.php" method="POST">
                    <div class="form-group">
                        <label class="sr-only" for="contact-email">Email</label>
                        <input type="text" name="email" placeholder="Email..." class="contact-email form-control" id="contact-email">
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="contact-subject">Subject</label>
                        <input type="text" name="subject" placeholder="Subject..." class="contact-subject form-control" id="contact-subject">
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="contact-message">Message</label>
                        <textarea name="message" placeholder="Message..." class="contact-message form-control" id="contact-message"></textarea>
                    </div>
                    <button type="submit" class="btn btn-success">Send</button>
</form>

in my php file, I just did a var_dump($_POST); and I'm very sure I write something in the input form, but it it returns me array(0) {}

</div>
  • 写回答

1条回答 默认 最新

  • dtwncxs3547 2017-04-14 19:32
    关注

    Change action="./assets/email.php" to action="assets/email.php"

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭