doulieyu0881 2017-02-15 12:33
浏览 102

使用在线文件管理器将文件上传到您的网站

I have a registration form at http://mutualpay.byethost7.com/wp/register.php?i=1.. my form action is signup.php..i created the file but it doesnt seem to work at all, when i click the signup button it loads to http://mutualpay.byethost7.com/wp/signup.php?i=2 , its like it is not executing the codes in the file

Here is my signup.php code

<?php session_start(); include 'dpconfig.php';
$first = $_POST['firsts'];
$last = $_POST['last'];
$uid = $_POST['uid'];   
$pwd = $_POST['pwd'];

if (empty($firsts)){
 header("Location: register.php?error=empty");
  exit();
}
if (empty($last)){
 header("Location: register.php?error=empty");
  exit();
}

 if (empty($uid)){
 header("Location: register.php?error=empty");
  exit();
}

if (empty($pwd)){
 header("Location: register.php?error=empty");
  exit();
}
else {
  $sql = "INSERT INTO user (firsts, last, uid, pwd)
 VALUES ('$firsts', '$last', '$uid', '$pwd')";
   $result = $conn->query($sql);
  header("Location: index.php")
}

its like this code are not executed, cos after clicking on the signup button, it brings a blank page, I dont know what can be the cause, any help appreciated.Thanks

  • 写回答

2条回答 默认 最新

  • doutang1856 2017-02-15 12:37
    关注

    In the first empty-check you check an undefined variable ($firsts). I guess you meant $first, but php does not guess like we humans do.

    change your code to

    if (empty($first)){
    

    edit: you could also merge those 4 empty-checks into one if, in order to have less code and better readability:

    if (empty($first) || empty($last) || empty($uid) || empty($pwd)){
        header("Location: register.php?error=empty");
        exit();
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c