Re: [php] passing variables doesn't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Every HTTP request is separate.

Nothing is preserved from one to the next unless you program it to be
preserved.

You can pass around hidden inputs.

You can use sessions.

You can store stuff in the DB.

You can use shared memory.

But ain't nothing gonna get shared that you don't make it be shared.

That's by DESIGN so that HTTP and PHP can "scale up" by just throwing
more servers into a web farm.

Any bottle-neck you create with your data-sharing is your bottle-neck,
by your choice, with your architecture, that you have to fix when it
breaks because you need to handle 100 million hits a second.

It ain't PHP's or HTTP's problem, though, cuz they're designed to
handle that by just buying more servers. :-)

On Wed, October 25, 2006 2:46 am, WILLEMS Wim \(BMB\) wrote:
> Dear all,
>
> I am trying to pass variables from one php-file to another but that
> doesn't seem to work. Anyone an idea what I am doing wrong?
>
> The first file shows a dropdown with all the databases on the server
> (only 1 for me). You have to select a database and put an SQL query in
> the textarea.
> Pushing "Execute query!" then calls the second file test2.php which
> should put all the variables on the screen (first there was another
> routine but that did not work, so I created this simple output to test
> the veriables).
>
> <html>
> <head>
> <title> PHP SQL Code Tester </title>
> </head>
> <body>
> <!--query.php-->
> <?php
>  $host="localhost";
>  $user="some_user";
>  $password="some password";
> ?>
> <form action="test2.php" method=post>
> Please select the database for the query:<br><br>
> <select name=database size=1>
> <?php
>  $wim = 5; /* this is added to test the passing of the variables -
> doesn't work either */
>  $link = mysql_connect($host, $user, $password)
>        or die(" Cannot connect : " . mysql_error());
>  $db_table = mysql_list_dbs();
>
>  for ($i = 0; $i < mysql_num_rows($db_table); $i++) {
>   echo("<option>" . mysql_tablename($db_table, $i));
>  }
> ?>
> </select>
> Please input the SQL query to be executed:<br><br>
> <textarea name=query cols=50 rows=10></textarea>
> <br><br>
> <input type=submit value="Execute query!">
> </form>
> </body>
> </html>
>
>
> This routine which is called with the routine above should print all
> variables but it doesn't. Well, the routine itself works but the
> variables are empty.
> <html>
> <head>
> <title>PHP SQL code tester</title>
> </head>
> <body>
> <!-- test2.php-->
> <?php
>  echo "Dit is een test<br>"; 	/* this is printed to the screen */
>  echo "$wim";			/* this is NOT printed to the screen */
>  echo "$host<br>";		/* only the <BR> is printed */
>  echo "$database<br>";		/* only the <BR> is printed */
>  echo "query: $query<br>";	/* only the <BR> is printed */
>  echo "Dit is test 2";		/* this is printed to the screen */
> ?>
> </body>
> </html>
>
>
> Thanks for your help,
> Wim.
>
> **** DISCLAIMER****
> http://www.proximus.be/maildisclaimer
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux