donglanfu5831 2015-01-02 16:57
浏览 47
已采纳

Wordpress - 发送处方集并使用header()

I try to apply solutions of others answers I have seen in this web but my redirect not work no way.

I have a formulary with the only mission is make a insert in a table and for that, I have 2 pages: 1 with a formulary and the other contains php code for the insert. Ok, the insertion works, but the header() function don't redirect me to the formulary again. Why?

$fecha = $_POST["fecha_marcaje"];
$hora = $_POST["hora_marcaje"];
$nombre = $_POST["nombre"];
$pin = $_POST["pin"];
$fechayhora = $fecha." ".$hora;



$con=mysqli_connect('************','************','************','************');
if (mysqli_connect_errno()) {
  echo "Error de conexión con la base de datos: " . mysqli_connect_error();
}


if(empty($fecha) || empty($hora)){

    echo "Debe rellenar todos los campos";
    }else{

    $sql="INSERT INTO `webemple_pw5`.`fichajes` (`Name`, `sTime`, `VerifyFlag`, `MachineName`, `checktype`, `sensorid`, `workcode`, `sDate`, `Pin`) VALUES ('$nombre', '$fechayhora', NULL, NULL, NULL, NULL, NULL, '$fecha', '$pin')";
    }

    //header("Location:". home_url('/') . "wp-content/themes/twentyfourteen/visualizar-tiempo.php?bn=$pin");
    if (!mysqli_query($con,$sql)) {
      die('Error: ' . mysqli_error($con));
    }
    header("Location: /wp-content/themes/twentyfourteen/visualizar-tiempo.php?bn=$pin");
    exit();
  • 写回答

1条回答 默认 最新

  • duanlu9816 2015-01-05 10:40
    关注

    Well, finally I found the solution...I did with javascript and it worked.

    window.location = "http://mdp.webempleado.es/visualizar-tiempo/?bn=" + <?=$pin?>;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题