dtvnbe1428 2014-01-07 02:31
浏览 120

我如何以Web表单将数据库发送到数据库

<?php
    if(isset($_POST['submit'])) {
       $name = $_POST['name'];
       $keywords = $_POST['keywords'];
       $description = $_POST['description'];
       $user_id = $_GET['user_id'];


?>        

I have a web form that needs to recognize the users id #. I have it set up where $user_id = $_GET['user_id']; I also believe that I have the id retrieval code right. I made sure that the user_id matched my table but I keep getting an error that says that user_id is an unidentified index.

  • 写回答

3条回答 默认 最新

  • douhua1760 2014-01-07 02:33
    关注

    This means that user_id is not being sent in the headers; You are using both GET and POST in that code snippet, you can only send one at a time when doing a HTTP Request unless your form action has query string in it.

    I believe what you could be doing is that on the page with your form, you have user_id set in the URL, however when that form is posted, you will loose all the query strings, so you need to do this;

    <form action="/post.php?user_id=123" method="POST">
    

    That should hopefully solve your issue.

    评论

报告相同问题?

悬赏问题

  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛