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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.