Jump to content


Photo

if()help


  • Please log in to reply
28 replies to this topic

#21 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 11 June 2006 - 06:29 PM

What do you mean by refresh? Do want the browser to refesh the page? If so why?

To refresh the page in javascript you can do this:
header("Refresh: 0; url=" . $_SERVER['PHP_SELF']);
provided that you dont have any output to the browser before you use that code.

#22 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 11 June 2006 - 06:34 PM

no.. not the page... you know , when you change something that is passed by $_session it wont take effect until th euser close the current section and open a new one.. you know that right?

so what i need is a way for when the user change something that is used by a section to refresh that user section so the new information is in his current section.

#23 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 11 June 2006 - 06:38 PM

Session data is updated automatically so you dont need to create a new session for the data come available! Where did you get that from?

#24 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 11 June 2006 - 06:43 PM

because i did a form and in the form it agree to set the level from 1 0 to 1 and when the i press the agree it change from 0 to 1, but when i try echo out the level it echo out 0 and when i destroy the session and stared a new one, it did echo out a 1.

#25 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 11 June 2006 - 07:19 PM

Was you echoing out $level or $_SESSION['level']. If you was echoing out $level that will not update as holds the old value of level session. If you echo'd out $_SESSION['level'] that should echo out your new level that you set with the form.

Looks you have a bug in your script somewhere if the new session data isn't comming through.

#26 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 11 June 2006 - 07:36 PM

so you saying A SESSION UPDATES AUTOMATICLY?when you got a site and something is passed by session dont you need to refresh that person session?

becuase it only seen to wokr when the session is destroy and is stared again.. and i seen logicly, becuase if the session is already going is going to have the same value that is passed on when a user log in :S..

is there any way i can send the user back to the usercheck to give them the newly update session info and then take them back to the page that they came from?

#27 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 12 June 2006 - 09:13 AM

What do you mean by restart that person session? You can change a persons session anywhere in your script such as you can do this:
<?php
session_start();

$_SESSION['lvl'] = "Something";

//some other code here

$_SESSION['lvl'] = "hello world";

?>
When you run that code first PHP will set the lvl session to 'Something' then further down PHP will rewrite the lvl session to 'hello world'. You dont need to destorythee session and then reset the session if you are chaning something in the session! You only do that when you are using cookies.

#28 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 12 June 2006 - 03:11 PM

them something must be wrong with my session because it only works if the session is destroy and restared.. the levle does change but only take effect after a new session is stared..

#29 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 12 June 2006 - 05:45 PM

When using sessions you do have session_start(); as the first line of code in every page that uses sessions dont you? Otherwise it seems that your sessions are not being handled correctly!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users