On Friday, April 5, 2002, at 09:55  AM, cyberskydive wrote:

> So I wanna learn how to code properly with register_globals off, I 
> reead on

Good idea, it's not really harder than doing it the old way and it helps 
you visualize where your data is coming from.  I actually prefer it this 
way.

> when I tried to edit an example session script I had from a book to use
> $_POST, $_REGISTER, or even $_SESSION i got a blank page on the 
> reload. I
> think sid is returning empty.

Yes, I have not yet seen a book that uses the register_globals off 
style.  Hopefully that will change as the shift towards register_globals 
off becomes more popular.

> Can anyone offer me advice on this, proper coding and or proper
> configuration in PHP.INI

Just turn register_globals off, and make sure you're using PHP 4.1.x or 
greater.  I don't know much about Windows so if there is something wrong 
with your server then somebody else will be a better help.

> I'm trying to learn all this at once-lol, and learn it properly the 
> first
> time around, especially since register globas will be deprecitated-poof.

Yep, that's what I did -- almost from the beginning I've been doing it 
this way.  Just make sure that any time you refer to data that comes 
from one of the superglobals arrays, you use $_*['variablename'] instead 
of just $variablename.  So if you have a cookie with a value of "Fred" 
and a name of "first_name", do $_COOKIE['first_name'] when you want to 
use that variable -- its value is "Fred".

The only one that works a bit different is $_SESSION['variablename'] -- 
it is the easiest way to set session variables.  Just do something like

// user has submitted POST data, and you have
// checked it for errors in your script
$_SESSION['variablename'] = $_POST['variablename'];  // put POST 
variable in a session


How easy is that!
Note that doing this assignment with any other superglobal doesn't work 
and in most cases wouldn't make sense anyway.  For instance, you can't 
set cookies using $_COOKIE['name'] = $name



Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to