我需要在我的标题位置获取我的work_id

时间:2014-09-14 19:20:10

标签: php mysql

我尝试将用户重定向到他可以看到作业的网站,在他插入后。

 if(isset($_POST[godkend])) { 
      $pdo = Database::connect();  
      $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    //write query
      $sql = "INSERT INTO godkend SET start = ?, job_art = ?, work_id = ?, nummer  = ?, work_done = ?"; 

    //prepare query for excecution
      $stmt = $pdo->prepare($sql);

    //bind the parameters
    //this is the first question mark
      $stmt->bindParam(1, $_POST['start']); 
    //this is the second question mark
      $stmt->bindParam(2, $_POST['job_art']); 
    //this is the third question mark
      $stmt->bindParam(3, $_POST['work_id']); 
     //this is the fourth question mark
      $stmt->bindParam(4, $_POST['nummer']);                
    // Execute the query
     $stmt->bindParam(5, $_POST['work_done']);  
       $stmt->execute();        


     $work_id = $_GET['work_id'];
      header("Location: web_opgaver.php?work_id='$_GET[work_id]'");     
      }

这是我正在处理的部分(上面的代码只会给我一个空白的work_id

 header("Location: web_opgaver.php?work_id=$work_id");      
      }

以上是相同的,我尝试了post,get和3-4其他的东西,但没有任何作用

任何帮助?

0 个答案:

没有答案