PHP won't parse form data.
I started teaching myself PHP some months back whilst I was still running Debian on my server. When I moved everything over to SuSE I found that the scripts that required form data wouldn't run and that I would always get the error message built in the script telling me that I hadn't sent the form data. Scripts that don't require form data work perfectly (ie: calls to mysql to return lists) as do the includes and other aspects of PHP. Just not the form data. I've looked in /etc/php.ini but can't figure out what isn't configured correctly. Yet I'm sure this must be something to do with SuSE 8.2 configuration defaults. For example: index.html <html><head><title>test PHP</title></head><body> <form action="test.php" method="post"> Enter search term:<input name="searchterm" type="text"><input type="submit" value="Search"> </form> </body></html> test.php <html><head></head><body> <?php echo("Search term = $searchterm"); ?> </body></html> This will produce "Search term =" . In other words none of the form variables are parsed to the next page. Has anyone had this problem? How can I fix it? cheers; sol -- ============================== Sol Hanna solATautonomonDOTnet
This will produce "Search term =" . In other words none of the form variables are parsed to the next page.
The ability to access form entries directly as PHP variables was a horrible security hole and was turned off by default in PHP some time ago. Clearly you've been using a server with the old, insecure, configuration settings. SuSE's PHP is configured to run as secure out of the box. You have two choices. Change the config back to the insecure method, or change your scripts. Option one is such a poor choice, I'm not going to tell you how to do it. :o) Option 2 is to use the _POST array to access your POST protocol variables: i.e. instead of: $searchterm use $_POST['searchterm'] A few minutes with a search and replace tool is required. :o) --
eatapple core dump
That would suggest that PHP under SuSE has register globals on:
add the line
global $searchterm;
and see if it works.
the reason you'd need to declare it globally is because it's not an
internal variable so thus if the variable is being defined from
elsewhere then PHP needs to know it has to parse it.
a useful function is phpinfo(); that'll tell you pretty much everything
about your installation of PHP
---------------------------------
Olipro - GTA Global
participants (3)
-
Derek Fountain
-
Olipro
-
Sol