|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Unable to read POST variables...
Helllo,
I am trying to create a page that calls itself and checks for variables. I am having some problems, so I figured I would create a simple test page and even that one does not work for me. Here is the code....can anyone help? Thanks!! <?php $message=""; if ( ! IsSet($PostVar) ) { $message="Welcome...please don't forget to set the PostVar on your way out!"; } else { $message = "Thanks for setting the PostVar"; } ?> <html> <head> <title>Self-Fulfilling Prophecy</title> </head> <body> <h1><?php print $message ?> </h1> <form action="<?php print $PHP_SELF?>" method="POST"> Set the post variable here: <input type="text" name="PostVar"> <input type=submit> </form> </body> </html> |
|
#2
|
|||
|
|||
|
Just found out why this (and many others) did not work anymore. Apparently, the latest builds of php have the "register_globals" setting in the php.ini file set to OFF as the default. Previously this setting was true. So, once i set it back to ON everything worked fine.
Apparently, one reason this change to the default setting was made is to make php code more secure. Now that I know everything is working, I'll probably reset to the default (OFF) and modify my code to get the variables as the Release notes suggest. ....douglas |
|
#3
|
|||
|
|||
|
just change the variables to $_POST[something]
|
|
#4
|
|||
|
|||
|
i personally find that the global command stops the errors, regardless of what version of php you are using
global $PostVar; |
|
#5
|
|||
|
|||
|
using globals is not good way of programming.
It makes your code less flexible. IMHO |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Unable to read POST variables... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|