How to pass variable $nameID to the secondpage.php? I don’t want to pass it through url because I want url to be clean.
Probably session is best solution but now I have a problem with the following code:
firstpage.php
<html>
<?php
session_start();
$nameID=…(I get name from database)
$name=…(I get name from database)
$_SESSION[‘nameID’] = $nameID;
echo “<a href=‘secondpage.php/$name’>$name</a>”;
?>
</html>
secondpage.php
<?php
session_start();
echo $_SESSION[‘nameID’];
?>
I get error message for this:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at E:\xampp\htdocs\firstpage.php:2) in E:\xampp\htdocs\firstpage.php on line 3
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\xampp\htdocs\firstpage.php:2) in E:\xampp\htdocs\firstpage.php on line 3
ernest
Please tell me what is wrong here.