Re: [PHP] [php] passing variables doesn't work

2006-10-26 Thread Richard Lynch
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:brbr
 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:brbr
 textarea name=query cols=50 rows=10/textarea
 brbr
 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
 titlePHP SQL code tester/title
 /head
 body
 !-- test2.php--
 ?php
  echo Dit is een testbr;  /* this is printed to the screen */
  echo $wim; /* this is NOT printed to the screen */
  echo $hostbr;/* only the BR is printed */
  echo $databasebr;/* only the BR is printed */
  echo query: $querybr;/* 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



[PHP] [php] passing variables doesn't work

2006-10-25 Thread WILLEMS Wim \(BMB\)
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:brbr
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:brbr
textarea name=query cols=50 rows=10/textarea
brbr
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
titlePHP SQL code tester/title
/head
body
!-- test2.php--
?php
 echo Dit is een testbr;/* this is printed to the screen */
 echo $wim;   /* this is NOT printed to the screen */
 echo $hostbr;  /* only the BR is printed */
 echo $databasebr;  /* only the BR is printed */
 echo query: $querybr;  /* 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



Re: [PHP] [php] passing variables doesn't work

2006-10-25 Thread Chris

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:brbr
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:brbr
textarea name=query cols=50 rows=10/textarea
brbr
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
titlePHP SQL code tester/title
/head
body
!-- test2.php--
?php
 echo Dit is een testbr;/* this is printed to the screen */
 echo $wim; /* this is NOT printed to the screen */


You're relying on register_globals being on.

That's not going to work in 99% of the cases, it's a security issue.

Instead everything goes into the $_POST array:

echo $_POST['wim'] . br/;

If the form action was get instead of post it would go into the 
$_GET array.


You should also read up on sanitizing user input and sql injection.
http://www.phpsec.org/ has quite a few good links on the subject(s).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] [php] passing variables doesn't work

2006-10-25 Thread Max Belushkin

Whatever form information you want to pass has to be part of the form.


WILLEMS Wim (BMB) wrote:
select name=database size=1


In the second script, the value of this will be in $_POST[database].


?php
 $wim = 5; /* this is added to test the passing of the variables -
doesn't work either */


$wim isn't part of your form - it will /not/ get saved into the next PHP 
script. You can handle it through input type hidden elements in the 
form, or through sessions, for example, depending on what you want to do 
with it.


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



Re: [PHP] [php] passing variables doesn't work

2006-10-25 Thread Jochem Maas
http://google.com/search?q=phpmyadmin

phpmyadmin has all the functionality you are trying to build - and it
implements it securely - even if you are writing the code/tool mentioned below
as a learning exercise (as opposed to writing it because you need to
be able to execute arbitrary queries easily) then the source of the
phpmyadmin project is a good resource.

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:brbr
 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:brbr
 textarea name=query cols=50 rows=10/textarea
 brbr
 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
 titlePHP SQL code tester/title
 /head
 body
 !-- test2.php--
 ?php
  echo Dit is een testbr;  /* this is printed to the screen */
  echo $wim; /* this is NOT printed to the screen */
  echo $hostbr;/* only the BR is printed */
  echo $databasebr;/* only the BR is printed */
  echo query: $querybr;/* 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



Re: [PHP] [php] passing variables doesn't work

2006-10-25 Thread Ivo F.A.C. Fokkema
On Wed, 25 Oct 2006 10:19:24 +0200, Max Belushkin wrote:

 Whatever form information you want to pass has to be part of the form.
 
 WILLEMS Wim (BMB) wrote:
 select name=database size=1
 
 In the second script, the value of this will be in $_POST[database].

... which will contain absolutely nothing, since you haven't provided any
value: optionblabla/option does not contain a value that can be sent
to the next page.

And, don't build the link to the database (and possibly spawn an error)
when you're right into your HTML and just printed select to the screen.
If the connection fails, the error will most likely not show up, you'll
have an empty select box, we'll get a new question from you etc.

Ivo

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