ID:               38418
 User updated by:  steamboy at gmail dot com
 Reported By:      steamboy at gmail dot com
 Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: Win 98, Linux
 PHP Version:      4.4.3
 New Comment:

Sorry, my bad ! It appears to be a browser issue indeed (with Firefox
0.8).


Previous Comments:
------------------------------------------------------------------------

[2006-08-11 08:19:14] [EMAIL PROTECTED]

PHP is server side language and it doesn't know about Javascript etc.
If your browser didn't sent POST data, there is nothing PHP can do
about it.

------------------------------------------------------------------------

[2006-08-10 23:59:58] steamboy at gmail dot com

Description:
------------
I'm sorry, I could not check the bug with the latest version of php
(only with 4.3.11), BUT before closing this topic, please try the code
I posted because the bug is so peculiar, I would be surprised if it had
been reported !

One line of javascript (displaying an html image tag with
document.write), prevents the setcookie function to work correctly when
the value is given with some conditional statements (using isset, or
hiding an error with @).

Simply enter a word in the input field.

Reproduce code:
---------------
<?php

if (!isset($_POST['aa'])) {$ax='00';} else {$ax=$_POST['aa'];}

setcookie('test',$ax);
var_dump($ax);

?>

<script type="text/javascript"> document.write('<img src>') </script>

<form method="post" action="" name="test">
<input type="text" name="aa"><br><br>
<input type="submit" value="Ok">

</form>

Expected result:
----------------
It should set a cookie named 'test' with the value you have entered in
the input field.

Actual result:
--------------
Instead it will set the '00' value to the cookie, even though dumping
the variable produces the expected result, that is the content of the
input field !

However, if you remove the javascript line, it will set the cookie with
the correct value !


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38418&edit=1

Reply via email to