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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题