页面无法刷新

时间:2015-01-20 08:13:52

标签: php jquery

我在清除POST时遇到问题,我认为这里的错误很多:     `

if(isset($_POST['btn_save_group'])){
  $day_ = "|";
  if(isset($_POST['day1'])){$day_ .= $_POST['day1'].'|';}
  if(isset($_POST['day2'])){$day_ .= $_POST['day2'].'|';}
  if(isset($_POST['day3'])){$day_ .= $_POST['day3'].'|';}
  if(isset($_POST['day4'])){$day_ .= $_POST['day4'].'|';}
  if(isset($_POST['day5'])){$day_ .= $_POST['day5'].'|';}
  if(isset($_POST['day6'])){$day_ .= $_POST['day6'].'|';}
  if(isset($_POST['day7'])){$day_ .= $_POST['day7'].'|';}
      $db->query("UPDATE csn_groups SET
        card_id='".$_POST['card_id']."',
        group_type='".$_POST['mac_grupas_veids_id']."',
        start_date='".$_POST['group_start']."',
        type='".$_POST['type']."',
        lang='".$_POST['mac_valoda_id']."',
        teacher='".$_POST['pasniedzejs_id']."',
        statuss='".$_POST['grupasstatuss_id']."',
        contract='".$_POST['contract']."',
        stud_days='".$day_."',
        stud_hours='".$db->real_escape_string($_POST['ah'])."'
        where id='".$_GET['id']."'
        ");
      $kart= $_POST['card_id'];
      $db->query("DELETE FROM csn_groups_times  where group_id='".$_GET['id']."'");
        foreach($_POST['datetime'] as $date){
          $db->insert("INSERT INTO csn_groups_times (group_id, date, time, teacher) VALUES ('".$_GET['id']."','".$date."','".$_POST['start_time_h']."-   ".$_POST['start_time_m']."', '".$_POST['pasniedzejs_id']."') ");  
          if(isset($db->insert_id)){

              echo '<meta http-equiv="refresh" content="0; url=index.php?view=groups&action=edit_group&id='.$g['id'].'&card_id='.$g['card_id'].'>';
              die();
           }      
        }
}`

添加元刷新后...

             if(isset($db->insert_id)){
             echo '<meta http-equiv="refresh" content="0; url=index.php?         view=groups&action=edit_group&id='.$g['id'].'&card_id='.$g['card_id'].'>';
          die();
       }      

...页面无法刷新。 Jquery,JS指的也不会在这里工作。

这是刷新页面,清除POST提交以及哪些不与JS共处的最简单方法? 完整代码: http://www.codesend.com/view/aafd6f6ecc5c1dc2cbb3068a2d2de731/

2 个答案:

答案 0 :(得分:0)

在单引号中使用双引号,反之亦然:

echo '<meta http-equiv="refresh" content="0; url=index.php?view=groups&action=edit_group&id='.$g["id"].'&card_id='.$g["card_id"].'>';

答案 1 :(得分:0)

在PHP中刷新页面的更好方法是,如果你不需要html甚至被呈现,就是使用这样的Header function

header("Location: index.php?view=groups&action=edit_group&id=".$g["id"]."&card_id=".$g["card_id"]);