<?php
session_start();
$customername =$_post["customername"];
$hobby = $_post["hobby"]
$_SESSION["customername"]="$customername";
$_SESSION["hobby"]="$hobby";
$target = "task11.php";
$link = "task11a.php";
echo link($target,$link);
?>
我的目标是从网站检索信息并分配会话变量,但我在会话变量上收到语法错误。我还必须建立一个链接。
答案 0 :(得分:0)
超全局变量始终为大写,因此$_post
应为$_POST
。您也错误地定义了会话。
从
更改您的代码session_start();
$customername =$_post["customername"];
$hobby = $_post["hobby"]
$_SESSION["customername"]="$customername";
$_SESSION["hobby"]="$hobby";
要
session_start();
$_SESSION["customername"] = $_POST["customername"];
$_SESSION["hobby"] = $_POST["hobby"];