Variables through Frames

Silver-0-surfer

Well-Known Member
Joined
Jan 5, 2008
Messages
317
Reaction score
7
Location
CPT
Hi

I'm really struggling with this one, hopefully someone can shed some light.

I have a web page that is just a normal php page, lets call it A, when the user clicks submit he is then sent to a web page that uses frames so on the left frame is X and the right frame is Y. the name of the frame page is Z

What I would like to do is when a user clicks submit on page A a variable will be passed containing an id relating to page A. i would like to pass this variable to X. I really don't want to pass it through the URL to Z but I need it on X. on X there are all sorts of links gets different info on Y.

I would really be stoked if any one can understand ^^ and could help me out
 
(if) you using JSF 2, use the flash implicit variable.
 
thanks.

What I did was just create a cookie, and then pull the value of it in a variable on the page I needed that. Now being super unskilled I just want to know are there any draw-backs or any serious problems with doing that?
 
or use $_SESSION

but why use iFrames ?
 
thanks.

What I did was just create a cookie, and then pull the value of it in a variable on the page I needed that. Now being super unskilled I just want to know are there any draw-backs or any serious problems with doing that?
with cookies no other thanthey may need url encoding to be garunteed is this variable bound to a quick request or session (what you expect)?
 
or use $_SESSION

but why use iFrames ?

1st. I had a look at $_SESSION, i only tried it for a second, it didn't really work though, not too sure what i did wrong

2nd. frames look cool, the whole menu on the left and the result on the right, i like it. Is there something that does it better?
 
with cookies no other thanthey may need url encoding to be garunteed is this variable bound to a quick request or session (what you expect)?

I think that its bound to the session...that kind of went over my head.

basically I went

setcookie('id', $id);

and then

if(!isset($_COOKIE['id'])) {
die("There has been an error.");
}else {
$id= $_COOKIE['id'];
}
 
the thing with iFrames... not all browsers support it. and some browsers even have options to turn it off.
other reason why i dont use it is: its rather hard to track visitors when using iframes.

for sessions:
start a page with : <?php session_start();

assign with: $_SESSION['id'] = $string;

destroy a session: session_destroy();

or unset the session if you want to remove one session.

(i used iframes before. but changed it to : <?php include("filename.php"); ?> works better for me. and... it keeps all my variables :)

good luck :)
 
1st. I had a look at $_SESSION, i only tried it for a second, it didn't really work though, not too sure what i did wrong

2nd. frames look cool, the whole menu on the left and the result on the right, i like it. Is there something that does it better?

You can still get that working, you know... What about includes an ajax, if you want a more fluid user experience?
 
Top
Sign up to the MyBroadband newsletter
X