我的标题位置不起作用

时间:2015-06-06 21:06:21

标签: php html

我的代码不起作用,它给出了这个错误:警告:无法修改标题信息 - 已经发送的标题(输出从/var/www/html/indexklant.php:91开始)/ var / 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");

1 个答案:

答案 0 :(得分:1)

尝试将header函数置于输出到屏幕的任何内容之上。或者,您可以使用输出缓冲并将header函数置于ob_flush函数之上。

如果您发布更多代码和输出,我可以改进这个答案。