Jump to content

php sessions help


a1amattyj

Recommended Posts

hi,

 

very new with sessions here.

 

currently on a "install" code which will install my script. the the pages are all install.php?step=1  ..2..3 etc etc

 

The first page asks for you details then the second grabs them :

 

$database_name = ($_POST['database_name']);

$database_password = ($_POST['database_password']);

$database_user = ($_POST['database_user'])

 

then checks for errors and trys to connect..

 

now, how can i pass this information from install.php?step=1 all the way to step=.. lets say 6

 

i guess session is the best? can someone please advise on how i pass this by a session for the variable $database_name.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/94177-php-sessions-help/
Share on other sites

It would probably be helpful to read the manual on sessions, but as a start...

 

One page 1...

<?php
session_start() // will initiate if it hasn't already and will do nothing if it has
$_SESSION["username"] = $_POST["username"];
?>

 

On page 6...

<?php
session_start()
echo "Welcome to the last page " . $_SESSION["username"];
?>

Link to comment
https://forums.phpfreaks.com/topic/94177-php-sessions-help/#findComment-482396
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.