Can anybody explain why php behaves inconsistently?
Posted: Tue Sep 01, 2009 4:14 am
Can anybody explain why php behaves inconsistently with the same script and
without a config file?
I have two php configurations and neither has a php.ini config file.
(a) PHP Version 4.0.6 (FreeBSD) Apache/1.3.6
(b) PHP Version 5.3.0 (Centos) Apache/2.0.63
On both webservers I'm running exactly the same php script with no changes.
On webserver (a) when input data is entered the form is immediately cleared
and nothing else happens. (This is clearly an error)
BUT, on webserver (b) [running exactly the same script] (neither webserver
has a php.ini config file) I enter my name "Dirty Harry"
and the webserver returns:
User Has submitted the form and entered this name : Dirty Harry
You can use the following form again to enter the new name.
[Question]
Why does one webserver work properly and the other, (with the same
script,) does not?
========================================================================
script is below
========================================================================
<?php if(isset($_POST['submit'])) {
$name = $_POST['name'];
echo "User Has submitted the form and entered this name : <b>" . $name . "</b>";
echo "<br>You can use the following form again to enter the new name.";
}
?>
<HTML>
<HEAD><title>Using PHP_SELF</title></HEAD>
<BODY>
<FORM name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Enter Your Name: <input type="text" name="name"><br>
<input type="submit" name="submit" value="Submit Form"><br>
</FORM>
</BODY>
</HTML>
without a config file?
I have two php configurations and neither has a php.ini config file.
(a) PHP Version 4.0.6 (FreeBSD) Apache/1.3.6
(b) PHP Version 5.3.0 (Centos) Apache/2.0.63
On both webservers I'm running exactly the same php script with no changes.
On webserver (a) when input data is entered the form is immediately cleared
and nothing else happens. (This is clearly an error)
BUT, on webserver (b) [running exactly the same script] (neither webserver
has a php.ini config file) I enter my name "Dirty Harry"
and the webserver returns:
User Has submitted the form and entered this name : Dirty Harry
You can use the following form again to enter the new name.
[Question]
Why does one webserver work properly and the other, (with the same
script,) does not?
========================================================================
script is below
========================================================================
<?php if(isset($_POST['submit'])) {
$name = $_POST['name'];
echo "User Has submitted the form and entered this name : <b>" . $name . "</b>";
echo "<br>You can use the following form again to enter the new name.";
}
?>
<HTML>
<HEAD><title>Using PHP_SELF</title></HEAD>
<BODY>
<FORM name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Enter Your Name: <input type="text" name="name"><br>
<input type="submit" name="submit" value="Submit Form"><br>
</FORM>
</BODY>
</HTML>