close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Nagging session variable problem - again

Thread began 4/16/2009 10:47 am by neileisen207079 | Last modified 4/16/2009 5:56 pm by johnlanglois | 1659 views | 7 replies |

neileisen207079

Nagging session variable problem - again

I tried changing things nearly 100 times, but still cant get this last piece to work. I have a text area on the checkout page (checkout.php) and its ID is "Message"

On the following page (confirm.php) I am setting a session variable, right in with all the others that are being set, like this:

<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["checkout_message"] = "".((isset($_POST["Message"]))?$_POST["Message"]:"") ."";
}
?>

Then later on that same page, I am showing the text from that session variable like this:

<?php echo ((isset($_SESSION["checkout_message"]))?$_SESSION["checkout_message"]:"") ?>

This all works properly.

When I confirm the order I go to the last page in the process, checkout_success.php

On that page ALL the other session variables are displayed and work properly, except this problem one. I am trying to display it like this:

<?php echo ((isset($_SESSION["checkout_message"]))?$_SESSION["checkout_message"]:"") ?>

It comes out blank.

As I said EVERY other variable on the page shows up fine. I tried changing the name, creating an entirely new one, etc, etc, - literally 20 different things - as much as I could think of. There is nothing else on that page that could be preventing it from displaying, but I am including it as an attachment just in case. I have spent about 4 hours on this one simple thing and I am totally out of ideas.

Attached Files
New Folder.zip
Sign in to reply to this post

neileisen207079

Needless to say, it isnt getting passed to the e-mail either. The funny thing is that I was having trouble passing the OrderID to the e-mail, since last night...and I fixed that...but looking back, the message seems to have been showing up in the e-mails last night, but not today.

Sign in to reply to this post

johnlanglois

Did you start the session

You need to start the session on every page you go to.
Think of it as a permission slip for the new page to see all the data that already exists on the server.

Sign in to reply to this post

neileisen207079

yeah, the session is started and all the other session variables show up. ??? but good thought.

Sign in to reply to this post

Ray BorduinWebAssist

You could try adding: session_commit() before the redirect on that page. I'm not sure why it would be needed but that would make sure the session variable was stored properly I would think.

Make sure to do a search on the page and make sure it isn't being unset or cleared anywhere.

Sign in to reply to this post

neileisen207079

How would I add that session commit?

Sign in to reply to this post

neileisen207079

I tried adding that but it seems to have had no effect.

Sign in to reply to this post

johnlanglois

Try it without the isset

This may be a long shot, but I thought a ternary expression was sort of an implied isset because it tests for true before providing the result.

Your expression <?php echo ((isset($_SESSION["checkout_message"]))?$_SESSION["checkout_message"]:"") ?>

Could be
<?php echo ($_SESSION["checkout_message"]?$_SESSION["checkout_message"]:"Test for false here");?>

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...