从SQL表中获取文本值以在标题中使用:位置

时间:2014-05-20 11:27:10

标签: php sql

我想从此SQL表中获取landing_page值并将其添加到标题位置

:我在页面顶部有以下代码,但这给了我一个空白页:

 <?php  
     foreach($[user_name] as $user) {
    $location="Location:http://".$user['landing_page'];
    header($location);
 }
 ?>

<!-- if you need user information, just put them into the $_SESSION variable and output them here -->
Order: <?php echo $_SESSION['user_name']; ?>. You are securely logged in.

我哪里错了?

enter image description here

enter image description here

原始代码是一个登录脚本,我试图让用户在登录后进入google.com

4 个答案:

答案 0 :(得分:1)

您没有正确附加变量。试试,

header('"'.$user['landing_page'].'");

答案 1 :(得分:1)

我认为你可以通过在标题

中附加参数来实现
header("Location: " . $user['landing_page']);

答案 2 :(得分:0)

试试这个:

<?php
header("Location: ".$user['landing_page']);
?>

答案 3 :(得分:0)

试试这个

 <?php  
     foreach($user_name as $user) {
        header("Location:http://".$user['landing_page']);
     }
 ?>

<?php  
     foreach($user_name as $user) {
        $location="Location:http://".$user['landing_page'];
        header($location);
     }
 ?>