using session instead of passing thru URL- newbie

using session instead of passing thru URL- newbie

am 04.08.2007 06:56:46 von unknown

Sorry if I don’t explain all the terms correctly, but I’m a newbie.

how can i change this code to accept a session for which week they
choose, with register_globals = on it worked fine, but my web hosting
site has changed register globals to off and I’d like to keep it off
and learn to program without passing variables in the URL.


for($i=1;$i<=17;$i++){
echo " href='http://".mysite.com."/pool/make_picks_form.php?week=$i '>".$i."";
echo "     ";
}

So my question is how to add a session[‘chngweek’] so I know which
week they picked to view.

Re: using session instead of passing thru URL- newbie

am 04.08.2007 08:14:20 von Matt Madrid

comatose wrote:
> Sorry if I don’t explain all the terms correctly, but I’m a newbie.
>
> how can i change this code to accept a session for which week they
> choose, with register_globals = on it worked fine, but my web hosting
> site has changed register globals to off and I’d like to keep it off
> and learn to program without passing variables in the URL.
>
>
> for($i=1;$i<=17;$i++){
> echo " > href='http://".mysite.com."/pool/make_picks_form.php?week=$i '>".$i."";
> echo "     ";
> }
>
> So my question is how to add a session[‘chngweek’] so I know which
> week they picked to view.

session_start();
$_SESSION['week'] = $_REQUEST['week'];


You should read:
http://www.php.net/manual/en/ref.session.php
and
http://www.php.net/manual/en/reserved.variables.php