Re: [PHP-DB] Don't mean to be repetitive - Session Variables
I apologize, fixed this problem a short while ago. I need to move the post statement a page ahead. Now all is working fine. Thank you , Stuart --- [EMAIL PROTECTED] wrote: > Have you assigned the values in the > $_SESSION['l_industry'] array to those > specific local variables, $l_industry['0'], > $l_industry['1']... ? > > dave > > > > > > > > > Stuart Felenstein <[EMAIL PROTECTED]> > > 10/11/2004 10:20 AM > > > > > > To: > [EMAIL PROTECTED] > cc: > > > > > > Subject: > Re: [PHP-DB] Don't mean to be repetitive - Session > Variables > > > > I may have spoken too soon. Having one minor > problem > with getting an array (from a multiple select) to > print out. Anyone see anything wrong here : > > Here is registering session array: > > if ( empty( $_SESSION['l_industry'] ) ) { > $_SESSION['l_industry']=array(); > } > > if ( is_array( $_REQUEST['LurkerIndustry'] ) ) { > $_SESSION['l_industry'] = array_unique( > array_merge( $_SESSION['l_industry'], > $_REQUEST['LurkerIndustry'] ) > ); > } > Here is my call: > > echo $l_industry['0'].""; > echo $l_industry['1'].""; > echo $l_industry['2'].""; > echo $l_industry['3'].""; > echo $l_industry['4'].""; > echo $l_industry['5'].""; > > > Thank you, > Stuart > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't mean to be repetitive - Session Variables
Have you assigned the values in the $_SESSION['l_industry'] array to those specific local variables, $l_industry['0'], $l_industry['1']... ? dave Stuart Felenstein <[EMAIL PROTECTED]> 10/11/2004 10:20 AM To: [EMAIL PROTECTED] cc: Subject: Re: [PHP-DB] Don't mean to be repetitive - Session Variables I may have spoken too soon. Having one minor problem with getting an array (from a multiple select) to print out. Anyone see anything wrong here : Here is registering session array: if ( empty( $_SESSION['l_industry'] ) ) { $_SESSION['l_industry']=array(); } if ( is_array( $_REQUEST['LurkerIndustry'] ) ) { $_SESSION['l_industry'] = array_unique( array_merge( $_SESSION['l_industry'], $_REQUEST['LurkerIndustry'] ) ); } Here is my call: echo $l_industry['0'].""; echo $l_industry['1'].""; echo $l_industry['2'].""; echo $l_industry['3'].""; echo $l_industry['4'].""; echo $l_industry['5'].""; Thank you, Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't mean to be repetitive - Session Variables
I may have spoken too soon. Having one minor problem with getting an array (from a multiple select) to print out. Anyone see anything wrong here : Here is registering session array: if ( empty( $_SESSION['l_industry'] ) ) { $_SESSION['l_industry']=array(); } if ( is_array( $_REQUEST['LurkerIndustry'] ) ) { $_SESSION['l_industry'] = array_unique( array_merge( $_SESSION['l_industry'], $_REQUEST['LurkerIndustry'] ) ); } Here is my call: echo $l_industry['0'].""; echo $l_industry['1'].""; echo $l_industry['2'].""; echo $l_industry['3'].""; echo $l_industry['4'].""; echo $l_industry['5'].""; Thank you, Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't mean to be repetitive - Session Variables
Jason, thank you for all the help today! It's all working now. However, warning: I maybe back when I try to slam it all into the database. Stuart --- Jason Wong <[EMAIL PROTECTED]> wrote: > On Monday 11 October 2004 19:42, Stuart Felenstein > wrote: > > I think I found the correct way. By registering > the > > session variable in the "next" page is how they > take. > > Form Page 1 - > > collect user input > > Form Page 2 - > > $_SESSION['name'] = $POST['myane']; > > > > This sound right? > > Yes (aside from the typos above). > > > I'm not sure if > > A) in the field area do i keep the value set as > > "value=""> or is > > that where my mistake is happening ? > > At this point $_SESSION['MyName'] is not defined > (not registered, and even if > it was registered you have nothing to put in it just > yet) and hence setting > your field value to it is meaningless. > > -- > Jason Wong -> Gremlins Associates -> > www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet > Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-db > -- > /* > When you say "I wrote a program that crashed > Windows", people just stare at > you blankly and say "Hey, I got those with the > system, *for free*". > */ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't mean to be repetitive - Session Variables
On Monday 11 October 2004 19:42, Stuart Felenstein wrote: > I think I found the correct way. By registering the > session variable in the "next" page is how they take. > Form Page 1 - > collect user input > Form Page 2 - > $_SESSION['name'] = $POST['myane']; > > This sound right? Yes (aside from the typos above). > I'm not sure if > A) in the field area do i keep the value set as > "value=""> or is > that where my mistake is happening ? At this point $_SESSION['MyName'] is not defined (not registered, and even if it was registered you have nothing to put in it just yet) and hence setting your field value to it is meaningless. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* When you say "I wrote a program that crashed Windows", people just stare at you blankly and say "Hey, I got those with the system, *for free*". */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't mean to be repetitive - Session Variables
I think I found the correct way. By registering the session variable in the "next" page is how they take. Form Page 1 - collect user input Form Page 2 - $_SESSION['name'] = $POST['myane']; This sound right? Stuart --- Stuart Felenstein <[EMAIL PROTECTED]> wrote: > > --- Jason Wong <[EMAIL PROTECTED]> wrote: > > > > The point is that you should understand *what* is > > going on with the examples. > > It's only when you've understood something that > you > > can then apply it to > > other situations. > > Your right and I agree with you. My perspective is > that the example(s) in the manual does not actually > address my particular situation. > In the manual example it's showing the session > variable > set to the value of count. If that value of count > changes, it's updated in the variable. > > > > The 'something' in your particular case is the > data > > from the form on Page1. Eg > $_SESSION['variable'] = $_POST['myforminput']; > > Yes, I've tried this, it didn't work so I'm doing > something wrong. > I'm not sure if > A) in the field area do i keep the value set as > "value=""> or is > that where my mistake is happening ? > > MyName is the value not the variable > so I think this is the right way to register the > variable: $_SESSION['name'] = $_POST['myname']; > > Maybe I leave the value blank and rely on the field > name ? > > Stuart > > > > -- > > Jason Wong -> Gremlins Associates -> > > www.gremlins.biz > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet > > Applications Development * > > -- > > Search the list archives before you post > > http://marc.theaimsgroup.com/?l=php-db > > -- > > /* > > About all some men accomplish in life is to send a > > son to Harvard. > > */ > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: > http://www.php.net/unsub.php > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't mean to be repetitive - Session Variables
--- Jason Wong <[EMAIL PROTECTED]> wrote: > The point is that you should understand *what* is > going on with the examples. > It's only when you've understood something that you > can then apply it to > other situations. Your right and I agree with you. My perspective is that the example(s) in the manual does not actually address my particular situation. In the manual example it's showing the session variable set to the value of count. If that value of count changes, it's updated in the variable. > The 'something' in your particular case is the data > from the form on Page1. Eg $_SESSION['variable'] = $_POST['myforminput']; Yes, I've tried this, it didn't work so I'm doing something wrong. I'm not sure if A) in the field area do i keep the value set as "value=""> or is that where my mistake is happening ? MyName is the value not the variable so I think this is the right way to register the variable: $_SESSION['name'] = $_POST['myname']; Maybe I leave the value blank and rely on the field name ? Stuart > > -- > Jason Wong -> Gremlins Associates -> > www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet > Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-db > -- > /* > About all some men accomplish in life is to send a > son to Harvard. > */ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't mean to be repetitive - Session Variables
On Monday 11 October 2004 17:35, Stuart Felenstein wrote: > > If you don't have a specific reason for this to be > > enabled you should disable > > it. > > I don't control it. On a shared server. OK. > > and try out the examples and understand what's going > > on. > > The examples don't seem to apply. The point is that you should understand *what* is going on with the examples. It's only when you've understood something that you can then apply it to other situations. > > Executive summary: > > > > do not enable register_globals > > $_SESSION['variable'] = 'something'; // to register > > a session variable > > Alright , I guess the light isn't shining through > here. 'Something' is setting the variable to something > the user can change with the form input ? The 'something' in your particular case is the data from the form on Page1. Eg $_SESSION['variable'] = $_POST['myforminput']; -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* About all some men accomplish in life is to send a son to Harvard. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't mean to be repetitive - Session Variables
--- Jason Wong <[EMAIL PROTECTED]> wrote: > If you don't have a specific reason for this to be > enabled you should disable > it. I don't control it. On a shared server. > > Question 1: is this enough to register the session > > variable ? > > No. You should read (repeatedly if necessary) > > manual > Session Handling Functions I think my repeats on reading has maxed out. I'll consider another hobby. > > and try out the examples and understand what's going > on. The examples don't seem to apply. They are applying a set value to the session variable: $count =1; if (!session_is_registered('count')) { session_register('count'); $count = 1; } else { $count++; } > Executive summary: > > do not enable register_globals > $_SESSION['variable'] = 'something'; // to register > a session variable Alright , I guess the light isn't shining through here. 'Something' is setting the variable to something the user can change with the form input ? Stuart -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Don't mean to be repetitive - Session Variables
On Monday 11 October 2004 16:47, Stuart Felenstein wrote: > I can't seem to figure this out. > Right now I'm still trying to get the multi page form > down. > For the facts, running php 4.3.8, apache 1.3.x > Register Globals are enabled If you don't have a specific reason for this to be enabled you should disable it. > So I'm starting the pages with: > session_start(); > ?> > > Now since this is a form, the user creates the value > for the variable, so within the form: > > value=""> > > Question 1: is this enough to register the session > variable ? No. You should read (repeatedly if necessary) manual > Session Handling Functions and try out the examples and understand what's going on. Executive summary: do not enable register_globals $_SESSION['variable'] = 'something'; // to register a session variable > If I send this form action post to a page where I > have: > session_start(); > ?. > .. > echo "\$myname = ".$myname.""; > ?> $myname is taken straight from your form, and because you have enabled register_globals it is available in the GLOBAL scope. That has nothing to do with your sessions. > The variable print out fine. > BUT - if I add another page between first and > printout, > echo "\$myname = ".$myname.""; - returns nothing 1) understand the paragraph above 2) realise that at no stage have you actually registered any session variables 3) realise that you have not propagated $myform from page2 to page3 either through a form or through the URL hence $myname is not available on page3. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php