LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Apache, php auto parameter variable empty (https://www.linuxquestions.org/questions/programming-9/apache-php-auto-parameter-variable-empty-89238/)

lanzdale 09-04-2003 12:12 PM

Apache, php auto parameter variable empty
 
Sorry, don't know if this is a setup, newbie or programming question.

Red Hat Linux 8, Apache/2.0.47 (Unix) PHP/4.3.3

Automatic assignment of html parameters seems not to be working. Setups were all by the book. No changes to defaults.
Same files work with newest windows xp php, apache versions.

Could there be some config needed in php, apache?

I know these are relatively new versions, but this couldn't be a bug could it?


File 1.php ==>

<html>
<body>
<form method="GET" action="2.php">
<input type="text" name="parm1">
<input type="submit">
</form>
</body>
</html>

Display in browser, enter anything, press submit.

File 2.php ==>

<html>
<body>
The value of parm1 is : <? echo $parm1; ?> always empty.
</html>
</body>

Saraev 09-04-2003 03:51 PM

Recent change in PHP defaults led to this. Two options:

1)
use <? echo $_POST[param1]; ?> (the better way)

2)
in php.ini turn "register_globals" to ON (the lazy way, but needed if you're moving existing code to a newer version)

If you're writing new stuff, use the $_GET $_POST and related variables.

lanzdale 09-04-2003 05:05 PM

That does look like a beter way. Makes variable definition explicit. easier to to debug in long run. You also have to know whether it's a post or get call. Thanks lot.


All times are GMT -5. The time now is 05:25 AM.