How can I test a php program that using the session varibles?

I have a PHP program that retrieve session variable info during our order process, I like to be able to see the changes to my email message that is created in the PHP program but I cannot process without processing an order, is there any way to run the PHP program even thought the session variable is empty?
Scott JohnstonSystems ConsultantAsked:
Who is Participating?
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
Put some test code at the top of the program that puts some data in the session variables.  I do that frequently to test parts of PHP programs.  Example #1 on shows what I'm talking about.  Once you set the values, you can run the rest of your program.
// page1.php


echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time']     = time();

// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';

// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';

Open in new window

Scott JohnstonSystems ConsultantAuthor Commented:
Great idea....Thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.