2015-06-06 100 views
0

我的代碼不工作,它給出了這個錯誤:警告:不能修改標題信息 - 已經發送的標題(在/var/www/html/indexklant.php:91開始輸出)在/無功/ www/html等/ indexklant.php上線115我的標題位置不起作用

這是我的代碼:

<form method="POST"> 
     <table> 
       <tr><td>Datum</td><td><input type="date" name="datum" value="" placeholder="datum" width="200px"required></td></tr> 
       <tr><td>activiteit</td> 
       <td><select name="activiteit" > 
       <option value="0" selected="selected"> Maak uw keuze  </option> 
       <?php 
        $query = mssql_query("SELECT id,omschrijving FROM activebreak.dbo.activiteiten"); 
       while($row = mssql_fetch_assoc($query)){ 
        $idact = $row["id"]; 
        $category2 = $row["omschrijving"]; 
        ?> 
        <option value= <?php $id ?> > <?php echo $category2 ?> </option> 
        <?php 
       }?> </select></td></tr> 

       <tr><td>personenaantal</td><td><input type="text" name="aantalpers" value="" placeholder="aantal personen" width="200px"required></td></tr> 
       <tr><td>dagdeel</td> 
       <td><select name="dagdeel" > 
       <option value="0" selected="selected"> Maak uw keuze</option> 
       <?php 
        $query2 = mssql_query("SELECT id,omschrijving FROM activebreak.dbo.dagdelen"); 
       while($row = mssql_fetch_assoc($query2)){ 
        $iddagd = $row["id"]; 
        $category = $row["omschrijving"]; 
        ?> 
        <option value= <?php $id ?> > <?php echo $category ?> </option> 
        <?php 

       }?> </select></td></tr> 

       <tr><td>maaltijd</td><td> 
        <select name="maaltijd" > 
         <option value="0" selected="selected"> 
          Maak uw keuze 
         </option> 
         <option> 
         niets 
         </option> 
         <option> 
         vis 
         </option> 
         <option> 
         vlees 
         </option> 
        </select></td></tr> 
        <tr><td> 
       <input type="submit" name="knop" value="aanmaken" /></td></tr> 
       </table> 
     </form> 

        if(isset($_POST['knop'])){ 
        $klant_id = $_SESSION["id"]; 
        $klant_naam = $_SESSION["naam"]; 
        $datum = $_POST['datum']; 
        $activiteit = $_POST['activiteit']; 
        $aantalpers = $_POST['aantalpers']; 
        $dagdeel = $_POST['dagdeel']; 
        $maaltijd = $_POST['maaltijd']; 


        $db = new Database($server, $username, $password, $database); 
        $db->InsertBestelling($datum,$klant_id,$activiteit,$aantalpers,$dagdeel,$maaltijd);       
        $dieReservatie = $db->resNummer($datum,$klant_id,$activiteit,$aantalpers,$dagdeel,$maaltijd); 
        $reservering = mssql_fetch_assoc($dieReservatie); 
        $reserveringid = $reservering['reserveringsnummer']; 
        $db->InsertActiviteit_in_res($reserveringid,$iddagd,$idact); 

        $_SESSION["klantnaam"] = $klant_naam; 
        $_SESSION["datum"] = $datum; 
        $_SESSION["dagdeel"] = $category; 
        $_SESSION["activiteit"] = $category2; 
        $_SESSION["maaltijd"] = $maaltijd; 
        $_SESSION["personen"] = $aantalpers; 
        Header("Location: invoice.php"); 
+0

似乎是造成這種情況的行顯然不在你的代碼片段中,發佈一個更完整的例子 –

+0

你應該發佈你得到的輸出。 – pcnate

回答

1

嘗試放置header功能上述任何輸出到屏幕上。或者,您可以使用輸出緩衝並將header函數放在ob_flush函數之上。

如果你發佈更多的代碼和輸出,我可以改善這個答案。

+0

我真的不知道你是什麼意思,我發佈了更多的代碼 –