How to pass the global variable without a form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rekha_harnoor
Forum Commoner
Posts: 32
Joined: Mon Feb 19, 2007 3:17 am

How to pass the global variable without a form

Post 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>
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

Use sessions. Look it up on http://www.php.net
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply