Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: apache AND PHP
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..
>
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Manitoba98
10-27-04 01:55 AM


Re: apache AND PHP
Manitoba98 wrote:
<?php
> function test() {
>  echo $HTTP_POST_VARS["testing"];
> }
> global $HTTP_POST_VARS;
> test(); 

It's either:

function test() {
echo $GLOBALS["HTTP_POST_VARS"]["testing"];
}

Or:

function test() {
global $HTTP_POST_VARS;
echo $HTTP_POST_VARS["testing"];
}


JW




Report this thread to moderator Post Follow-up to this message
Old Post
Janwillem Borleffs
10-28-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:48 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.