| Manitoba98 2004-10-26, 8:55 pm |
| Sending variables like that only works if register_globals is set to on.
You could set register_globals to on, or, as I would suggest, use $_POST (or
$HTTP_POST_VARS) or $_REQUEST.
$_POST (or $HTTP_POST_VARS in older versions, but is deprecated) is any
array populated with data sent using the POST method (usual method with
forms)
$_GET and $_COOKIE (or $HTTP_GET_VARS and $HTTP_COOKIE_VARS in older
versions, but are deprecated) store GET and cookie data
With those deprecated variables, you have to do a "global $HTTP_POST_VARS"
or similar to make them available within functions and methods.
$_REQUEST is a combination of those three. In your case however, I would
simply change the code in test.php to:
<?php
echo $_POST["testing"];
?>
BTW, $_POST, $_GET, $_COOKIE, and $_REQUEST were introduced in PHP 4.1.0.
For more information of these variables, see
http://www.php.net/reserved.variables. So, for an older version of PHP
(pre-4.1.0), test.php would have to read:
<?php
echo $HTTP_POST_VARS["testing"];
?>
but if you wanted it within a function:
<?php
function test() {
echo $HTTP_POST_VARS["testing"];
}
global $HTTP_POST_VARS;
test();
?>
But basically, just use the first example in your case.
Manitoba98
"EvilNet" <evilnet@Sin.Esto.terra.cl> wrote in message
news:3f7b78b3@dnewserver.firstcom.cl...
> Hi!
> I installed a server with apache compiled with php..
> i made the following
>
> apache> ./configure --prefix=/var/www
> apache> cd ../php-4.3.2
> php>./configure --with-apache=../apache --with-mysql --enable-track-vars
> php> make
> php> make install
> php> cd ..
> apache>./configure --prefix=/var/www
> --activate-module=src/modules/php4/libphp4.a
> apache>make
> apache>make install
>
> well, when i try to send any var to another php file it doesn't print
> anything, example..
>
> <form action="test.php" method=POST>
> <input type="text" name="testing">
> <input type="submit" value="send" name="go">
>
> in the test.php file
>
> <?php
> echo $testing;
> ?>
>
> it should show anything that i type in the textbox named "testing"
> but it doesn't... any idea??
>
> i will appreciate..
>
>
>
>
|