duanmao1975 2013-10-02 18:40
浏览 40
已采纳

我的代码出了什么问题? 9

here is my code:

Notice: Undefined index: id in C:\xampp\htdocs\3\header.php on line 36 Notice: Undefined index: id in C:\xampp\htdocs\3\header.php on line 47

    <tr>
        <td>
                <table align=center>
                <tr align=center>
                        <td><a href="index.php">Ask</a> | </td>
                        <td><a href="search.php">Questions</a> | </td>
                        <?php if ($_SESSION['id'] == ""): ?>
                        <td><a href="login.php">Login</a> | </td>
                        <td><a href="register.php">Register</a></td>
                        <?php else: ?>
                        <td><a href="expdir.php">Expert Directory</a> | </td>
                        <td><a href="logout.php">Logout</a> </td>
                        <?php endif; ?>
                </tr>
                </table>
                <table align=center>
                <tr align=center>
                    <?php if ($_SESSION['id'] != ""): ?>
                        <td><a href="cpanel.php">My Control Panel</a> | </td>
                        <td><a href="search.php?id=<?php echo $_SESSION['id']; ?>
">My Questions</a> | </td>
                        <?php if ($_SESSION['type'] == 'expert'): ?>
                                <td><a href="feedback.php">Feedback</a> | </td>
                        <?php endif; ?>
                        <td><a href="pm_inbox.php">Private Messenger</a> | </td>
                        <td><a href="reports.php?action=Accepted">Reports</a> | </td>
                        <td><a href="contact.php?action=Accepted">Contact</a> </td>
                    <?php endif; ?>
                </tr>
                </table>
        </td>
</tr>
  • 写回答

2条回答 默认 最新

  • dongzj2015 2013-10-02 18:42
    关注
    <?php if ($_SESSION['id'] != ""): ?>
    

    should be

    <?php if (isset($_SESSION['id']) && $_SESSION['id'] != ""): ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 yolov8边框坐标
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂