警告:无法修改标头信息 - 第29行中已由错误发送的标头

时间:2015-04-04 07:19:45

标签: php html5 forms header

在configuration.php第6行显示错误。警告:无法修改标头信息 - 已经/ home / midhu /中已发送的标头(在/home/midhu/public_html/feedback/config/configuration.php:6中开始输出)第29行的public_html / feedback / submit.php

1. opendb.php
<?php
$con = mysql_connect('localhost','midhu_feedback','feedback@123') or die('Error connecting to mysql');
    mysql_select_db(midhu_feedback);
    ?>

页面

2.configuration.php

    <?php
                $host='localhost';
                $dbname='midhu_feedback';
                $username='feedback';
                $password='feedback@123';
            ?>   

页面

 3. submit.php


    <?php
                session_start();
                include("../feedback/config/configuration.php");
                include("../feedback/config/opendb.php");
                $sql="insert into feedback(name,mobile,place,class,email,college,technologies_interested_in,mobile_apps_development,feedback,interested_to_study_latest_technologies)values('".$_SESSION["name"]."','".$_SESSION["phone"]."','".$_SESSION["place"]."','".$_SESSION["class"]."','".$_SESSION["email"]."','".$_SESSION["college"]."','".$_SESSION["technology"]."','".$_SESSION["mobile"]."','".$_SESSION["feedback"]."','".$_SESSION["interested"]."')";

                mysql_query($sql);

                $sql="select * from feedback where mobile='".$_SESSION["phone"]."'";
                $result=mysql_query($sql);


                while($row=mysql_fetch_array($result))
                {
                    $id=$row['id'];
                    $name=$row['name'];
                    $phone=$row['mobile'];
                    $place=$row['place'];
                    $class=$row['class'];
                    $email=$row['email'];
                    $college=$row['college'];
                    $technology=$row['technologies_interested_in'];
                    $mobile=$row['mobile_apps_development'];
                    $feedback=$row['feedback'];
                  $interested=$row['interested_to_study_latest_technologies'];


                }
                header('location:display.php?id='.$id.'&name='.$name.'&phone='.$phone.'&place='.$place.'&class='.$class.'&email='.$email.'&college='.$college.'&technology='.$technology.'&mobile='.$mobile.'&feedback='.$feedback.'&interested='.$interested);

            $_SESSION['name'];
            $_SESSION["phone"];
            $_SESSION["place"];
            $_SESSION["class"];
            $_SESSION["email"];
            $_SESSION["college"];
            $_SESSION['technology'];
            $_SESSION['mobile'];        
            $_SESSION['feedback'];
            $_SESSION['interested'];

            $_SESSION["phone"]=$phone;  
        ?>

页  Display.php的                                                                                   

        <style>
            a{
                margin-left: 20px;
                padding-left: 20px;
                }
            #table{
                    padding-left:20px;

                }
            #border{
                    border: 2px solid rgb(92, 184, 92) !important;
                    height: 179px;
                    width: 235px;
                }
            h5{
                padding-left:20px;
                }
            #table{
                padding-left:20px;
                  margin-left: 20px;
                }

        </style>

    </head>

<body><br><br>
<div class="container"><br>

            <br><a href="export.php" class="btn btn-success" >EXPORT TO PDF</a><br><br>
            <h5><i> Submitted data successfully... </i></h5><br>
                <div id="table">
                    <table border="1" >



                        <tr>
                                <th>Sl.No</th>
                                <th>Name</th>
                                <th>Mobile</th>
                                <th>Place</th>
                                <th>Class</th>
                                <th>Email</th>
                                <th>College</th>
                                <th>Technologies Interested In</th>
                                <th>Mobile Apps development</th>
                                <th>Feedback</th>
                                <th>Interested To Study Latest Technologies</th>
                        </tr>

                        <tr>
                                <td><?php echo $_GET['id']; ?></td>
                                <td><?php echo $_GET['name']; ?></td>
                                <td><?php echo $_GET['phone']; ?></td>
                                <td><?php echo $_GET['place']; ?></td>
                                <td><?php echo $_GET['class']; ?></td>
                                <td><?php echo $_GET['email']; ?></td>
                                <td><?php echo $_GET['college']; ?></td>
                                <td><?php echo $_GET['technology']; ?></td>
                                <td><?php echo $_GET['mobile']; ?></td>
                                <td><?php echo $_GET['feedback']; ?></td>
                                <td><?php echo $_GET['interested']; ?></td>
                        </tr>

                    </table>
                </div>

</div>

</body>

1 个答案:

答案 0 :(得分:0)

ob_start();放在submit.php页面的顶部。在致电header();

之前,您有一个输出

阅读更多内容:

  

http://php.net/manual/en/function.ob-start.php