Passing Variables Between Forms.
Posted: Tue Nov 26, 2002 6:49 pm
Hi folks,
I'm very new to PHP and have been having trouble configuring my installation on Windows XP Professional. I have installed Apache HTTP Server 1.3.27 and am using PHP 4.2.3 using the Apache Module DLL (Sapi Module). I run Apache in a console window also (not as a service) and the status line at the top of the console window says "Apache/1.3.27 (Win32) PHP/4.2.3 running...
So it all appears fine to me and I have run some sample PHP scripts with no problems. However, as soon as I try to do something to do with variables like create a simple form and pass a variable from one to another it won't work.
My sample code is below;
test1.php
------------------------------------------------------------------------
<?php
# test1.php
echo "<FORM METHOD=\"POST\" ACTION=\"test2.php\">";
echo "<INPUT TYPE=\"TEXT\" NAME=\"var1\" VALUE=\"$var1\">";
echo "<INPUT TYPE=\"SUBMIT\" VALUE=\"TEST\">";
echo "</FORM>";
?>
test2.php
------------------------------------------------------------------------
<?php
# test2.php
echo "The value of \$var1 is \"$var1\"";
?>
My output is always;
The value of $var1 is ""
I have experimented with POST and GET and neither helps, so I have come to the conclusion that somewhere in my configuration of PHP with Apache I have gone wrong... I am getting a little bit frustrated and would appreciate any help that can be offered. Thanks in advance!
Cheers,
Adrian.
email: letsdosomethingthatreallycooks@hotmail.com.
I'm very new to PHP and have been having trouble configuring my installation on Windows XP Professional. I have installed Apache HTTP Server 1.3.27 and am using PHP 4.2.3 using the Apache Module DLL (Sapi Module). I run Apache in a console window also (not as a service) and the status line at the top of the console window says "Apache/1.3.27 (Win32) PHP/4.2.3 running...
So it all appears fine to me and I have run some sample PHP scripts with no problems. However, as soon as I try to do something to do with variables like create a simple form and pass a variable from one to another it won't work.
My sample code is below;
test1.php
------------------------------------------------------------------------
<?php
# test1.php
echo "<FORM METHOD=\"POST\" ACTION=\"test2.php\">";
echo "<INPUT TYPE=\"TEXT\" NAME=\"var1\" VALUE=\"$var1\">";
echo "<INPUT TYPE=\"SUBMIT\" VALUE=\"TEST\">";
echo "</FORM>";
?>
test2.php
------------------------------------------------------------------------
<?php
# test2.php
echo "The value of \$var1 is \"$var1\"";
?>
My output is always;
The value of $var1 is ""
I have experimented with POST and GET and neither helps, so I have come to the conclusion that somewhere in my configuration of PHP with Apache I have gone wrong... I am getting a little bit frustrated and would appreciate any help that can be offered. Thanks in advance!
Cheers,
Adrian.
email: letsdosomethingthatreallycooks@hotmail.com.