How to use session variable

This is a discussion on How to use session variable within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, Total PHP newbie here. I'm trying to use PHP 4.3.6 in Dreamweaver MX, and I want ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-05-2004
Jakob Rohde
 
Posts: n/a
Default How to use session variable

Hi,

Total PHP newbie here.

I'm trying to use PHP 4.3.6 in Dreamweaver MX, and I want to make a login
form that has a drop down. The value that the user selects prior to hitting
the submit button, should be saved in a session variable, and displayed on
the following pages.

Could someone please explain in a simple manner (if that is possible) how I
can acheive that using Dreamweaver?

TIA,

Jakob


Reply With Quote
  #2 (permalink)  
Old 09-05-2004
Janwillem Borleffs
 
Posts: n/a
Default Re: How to use session variable

Jakob Rohde wrote:
> I'm trying to use PHP 4.3.6 in Dreamweaver MX, and I want to make a
> login form that has a drop down. The value that the user selects
> prior to hitting the submit button, should be saved in a session
> variable, and displayed on the following pages.
>
> Could someone please explain in a simple manner (if that is possible)
> how I can acheive that using Dreamweaver?
>


I have no experience with DW, but here's an example:

<?

if (isset($_POST['choice'])) {
// Start session support
session_start();

// Set the session var
$_SESSION['choice'] = $_POST['choice'];

// Redirect to a following page
header("Location: next.php");
}

?>
<form method="post">
<select name="choice">
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<input type="submit" />
</form>


And on next.php:

<?
session_start();
$choice = $_SESSION['choice'];
// etcetera...
?>


JW




Reply With Quote
  #3 (permalink)  
Old 09-07-2004
Breaker One
 
Posts: n/a
Default Re: How to use session variable

Jakob Rohde wrote:
> Hi,
>
> Total PHP newbie here.
>
> I'm trying to use PHP 4.3.6 in Dreamweaver MX, and I want to make a login
> form that has a drop down. The value that the user selects prior to hitting
> the submit button, should be saved in a session variable, and displayed on
> the following pages.
>
> Could someone please explain in a simple manner (if that is possible) how I
> can acheive that using Dreamweaver?
>
> TIA,
>
> Jakob
>
>

I don't know what the stance is on linking webpages in this newsgroup so
I'm sorry if it's against the rules. Here is a link to a pretty decent
Session intro.
http://www.phpfreaks.com/tutorials/41/0.php
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:03 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0