| 
	
 | 
 Posted by ZeldorBlat on 07/11/07 17:19 
On Jul 11, 12:55 pm, qazwart <qazw...@gmail.com> wrote: 
> I am new to PHP, but have been a Perl programmer for over a couple of 
> decades. My question isn't necessarily a particular programming 
> question, but has to do with passing variables between PHP programs: 
> 
> I have a file that contains two fields on each line: The build number 
> tag and the QA Release tag. I display a form and give users a chance 
> to do one of three things: 
> 
> 1. Generate release notes between any two QA releases. 
> 2. Generate new release notes for the next QA release. 
> 3. Generate release notes for a previous release. 
> 
> The source files are stored in CVS and I am using the "cvs rlog" 
> command to build the release notes which consists of all the files 
> that have been modified, deleted or added and the check in comments. 
> The user selects the QA releases via a drop down fields in the form. 
> In order to just get the files that have been changed, I need a "From" 
> release and a "To" release. 
> 
> For item #1, this is pretty simple because the user gives me the 
> "From" and "To" release. For item #2, I store the information I need 
> in hidden fields. Item #3 is the tricky one. The user is selecting 
> only a single release (the "To" release), and I have to figure out the 
> previous release in order to generate the release notes. I know the 
> name of the file, and could easily parse the file to find this 
> information, but I already did this once in order to build the drop 
> down fields. 
> 
> What I would really like to do is pass the whole PHP variable array 
> from one PHP program to another between http calls much like the _POST 
> array does. I see several ways of doing this: 
> 
> * Use a SQL database. This seems like a bit of overkill for just this 
> one item. 
> * Use hidden fields: There could be dozens, if not hundreds of 
> releases to choose from. That's a lot of data to pack into a form. 
> * Use cookies: I know I can pass single pieces of data to cookies, but 
> a whole array? 
> 
> So, exactly how do you pass a lot of information from one PHP program 
> to another between http calls? Global variables don't work in this 
> case because the variables lose their information between http calls. 
 
Use sessions: 
 
<http://www.php.net/session> 
 
On page 1: 
 
<?php 
session_start(); 
$_SESSION['foo'] = 'bar'; 
?> 
 
On page 2: 
 
<?php 
session_start(); 
echo $_SESSION['foo']; 
?>
 
  
Navigation:
[Reply to this message] 
 |