close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Not able to get value from session

Thread began 4/17/2016 3:15 pm by rogersds267040 | Last modified 4/26/2016 2:39 pm by Ray Borduin | 435 views | 21 replies |

rogersds267040

Not able to get value from session

I'm trying to get session value but not able to. Even thought he values are in session when they are printed as seen below.

Tried using <?php echo $_SESSION['Renter_Age']; ?> to get the session value but it's blank.


Array
(
[WASF_IndexBooking_HomeBooking_HomeBooking] => Array
(
[Pickup_Location] => UVF
[Pickup_Date] => 04/18/2016
[Pickup_Time] => 8:00 AM
[Return_Date] => 04/18/2016
[Return_Time] => 10:00 AM
[Renter_Age] => 25+
[IndexBooking_submit] => Submit
[PHPSESSID] => p01j2iprtb3k64t8f945nbhsg1
)

)

Sign in to reply to this post

Dave BuchholzBeta Tester

try

<?php echo $_SESSION['WASF_IndexBooking_HomeBooking_HomeBooking']['Renter_Age']; ?>
Sign in to reply to this post

rogersds267040

Thank you Dave.

I have a quick questions. I'm a newbie in php.

How can I update a session value using another form? I'm creating a car rental site.

Lets say someone enters pickup date and time on the first page and went to a summary. Then they decide to change the pickup date and it's in session. How could I change the session value?

Any assistance will be appreciated.

Sign in to reply to this post

Ray BorduinWebAssist

You can set the value just like you would any other variable:

<?php
$_SESSION['WASF_IndexBooking_HomeBooking_HomeBooking']['Renter_Age'] = "22";
?>

Sign in to reply to this post

rogersds267040

Thank you very much Ray.

The reason I asked the question is because I have a page which looks fine but the session is not getting updated from the form.

I have attached the page.

Attached Files
update.php
Sign in to reply to this post

Ray BorduinWebAssist

What exactly are you trying to save and where? The action of this form is set to booknow.php, which means any code saving sessions from the form would have to be on that page.

Sign in to reply to this post

rogersds267040

Updating session values

Hello Ray,

Just to give you a little background of what I'm trying to accomplish. I'm creating a car rental website. (http://www.hsautorental.com/index.php)

On the first page (http://www.hsautorental.com/index.php) a user can start reserving a vehicle. The first page I collect Pickup location, Pickup date, pickup time, return date, return time, and renter age. All this information go into session when submitted.

On the next page, the user selects a vehicle and navigates to the summary page. On the summary page (bookNow.php) the user can modify the session values by clicking the MODIFY link next to the variable. They will be navigated to update.php page where they can make the update which supposed to be in session. By selecting the correct values in the form, on submit, it supposed to update the session values and take you back to the bookNow page.

What I'm noticing, from the bookNow.php page, the values for the date and time are not defaulting in the form on the update.php page.
Also, on submit, the session values are not being updated.

Any assistance you can provide will be appreciated.

Sign in to reply to this post

Ray BorduinWebAssist

You would have to add the code to update the session on teh bookNow.php page (the action page of the form) any code reacting to the form post has to be on the action page... that page has no code to update the session currently, which is why it isn't updated.

Sign in to reply to this post

rogersds267040

Thank you Ray.

I will try this option.

How can I default the Date and Time from session to the update.php page form?

Sign in to reply to this post

Ray BorduinWebAssist

It should work just like any other field.... it looks like you are referring to the session as: "IndexBooking_NewFromBlank_Default" but earlier I see the session saved is: "IndexBooking_HomeBooking_HomeBooking"

Try doing a find and replace to use the correct session reference.

Sign in to reply to this post
loading

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