Another possible way is to perhaps use an external file... For instance take
the variable that is 30 lines long write it into a temporary directory/file
and then use the include function to include that file. Write the output
such that the data is assigned to a variable. Something like this:

<?php
    $myfile=fopen("tempfile.php","w");
    fwrite($myfile,"<?php    \$cheese=\"");    /* this is the header of the
file that will make it behave as a php script when imported  */

    fwrite($myfile,$varline1);
    fwrite($myfile,$varline2);
    .....
    fwrite($myfile,"\"   ?>"); /*  here we terminate the quoted string */

when done, tempfile.php should look like this:

<?php    $cheese=" varline1 contents here
           varline2 contents here
    .......
"?>


 then call your other page like this:
    test.php?cheesefile=tempfile.php

and then when the test.php starts you can use an include file like this:

<?php   include("tempfile.php"); ?>

Once you do that, $cheese will automatically be containing the 30 lines of
stuff you assigned to it.... It's very simple as you can see but it does
require a bit of maintenance (how to delete tempfile, etc...) but it is a
solution rather than passing 30 lines of text from server to client. Keep in
mind that transfering all that might cause additional problems and
performance issues. By keeping your data at hand on the server a simple
fopen and fclose can do the job. By self writing code you only have to write
the file and not read it later.

My 2 cents,
(Perhaps 3 cents),
Jorge
[EMAIL PROTECTED]
----- Original Message -----
From: Maureen <[EMAIL PROTECTED]>
To: Tanya Brethour <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 3:51 PM
Subject: Re: [PHP-DB] Passing vars


> I may be totally wrong or missing something, (if so, someone please let
> me know) but ...
>
> 1. One way would be to use the variables and urlencode them before
> passing them.
> $var1=urlencode($var1)
> then you have test.php?cheese="<?echo $var1?>"
>
> OR
>
> 2.  Another way would be to use a form:
> <form method=post action="test.php">
>
> and then add the 6 variables as
>
> <input type=hidden name="var1" value="<?echo $var1?>">
> <input type=hidden name="var2" value="<?echo $var2?>">
> <input type=hidden name="var3" value="<?echo $var3?>">
> <input type=hidden name="var4" value="<?echo $var4?>">
> <input type=hidden name="var5" value="<?echo $var5?>">
> <input type=hidden name="var6" value="<?echo $var6?>">
>
> and then have a submit button to take you to the next page.
>
> Tanya Brethour wrote:
>
> > Quick question..
> >
> > If I have like 6 variables to pass to another PHP script... and some of
> > the vars are actually multiple lines of text (lets say over 30 lines).
> > What is the best way of doing this?
> >
> > I would like to avoid doing something like test.php?cheese=(30 lines of
> > stuff)
> >
> > Thanks in advance!
> > -Tanya
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to