Page 1 of 1

How to pass the global variable without a form

Posted: Wed Mar 07, 2007 1:56 pm
by rekha_harnoor
Hi I am using php5 and apache 2. My code is as below.
I want to pass the variables $category and $search_txt(which I am getting from a form) to x.php, y.php and z.php. please tell me how to pass it? What should I write inside x.php, y.php and z.php to get the value?

Code: Select all

<?php
// frames.php
   global $category, $search_txt;
   $category = $_POST["category"];
   $search_txt = $_POST["search_text"];
   
?>

<html>
<head>
<title>HotDeals Inc.</title>
</head>

<FRAMESET ROWS="10%,80%,10%">
<FRAME SRC="header_nav.php">



<FRAMESET COLS="33%,34%,33%">
<FRAME SRC="x.php">
<FRAME SRC="y.php">
<FRAME SRC="z.php">

</FRAMESET>
</FRAMESET>
</FRAMESET> 

</html>

Posted: Wed Mar 07, 2007 2:03 pm
by Begby
Use sessions. Look it up on http://www.php.net

Posted: Thu Mar 08, 2007 8:21 am
by feyd
Sessions can't always guarantee being passed from the frames depending on how the browser loads if the session hasn't already been started before this page has loaded. I'd suggest passing them via the URL.