ID:               29880
 Updated by:       [EMAIL PROTECTED]
 Reported By:      r dot wilczek at web-appz dot de
-Status:           Open
+Status:           Feedback
 Bug Type:         Session related
 Operating System: Windows XP Prof.
 PHP Version:      5.0.0
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip




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

[2004-08-29 11:49:08] r dot wilczek at web-appz dot de

Description:
------------
Sometimes I encounter the strange behaviour that PHP does not add an 
<input type="hidden" name="PHPSESSID" value="6745etcetc" />
in forms having additional whitespaces in the <form>-tag.

I like to have forms readable and often write them like shown in
tmplt_button_form.php below.

Sometimes it works; sometimes I have to strip all additional
whitespaces from the opening <form>-tag to make PHP rewriting the
HTML-output. 
Switching output-buffering on and off did not change the effect. Had
the same phenomenon in PHP 4 before.

So my workaround for now is not to write
<form method="post" 
      action="[-- URL --]">

but 
<form method="post" action="[-- URL --]">

- Roland

Reproduce code:
---------------
// The method ...
function HTMLButton($url, $action, $comment)
{
    $file  = 'templates/tmplt_button_form.php';
    $tmplt = implode('', file($file));
    $replace = array(
           '[-- URL --]'     => htmlentities($url),
           '[-- ACTION --]'  => htmlentities($action),
           '[-- COMMENT --]' => htmlentities($comment)
    );
    echo strtr($tmplt, $replace);
}

-- The file tmplt_button_form.php: --

<form method="post" 
      action="[-- URL --]">
 <input type="hidden" 
        name="myaction" 
        value="[-- ACTION --]">
 <input type="submit" 
        value="[-- COMMENT --]">
</form>

Expected result:
----------------
<form method="post" 
      action="http://www.default.com";><input type="hidden"
name="PHPSESSID" value="6745135150906f4748b27d0cbe43d99a" />
 <input type="hidden" 
        name="myaction" 
        value="someAction">
 <input type="submit" 
        value="Just do it!">
</form>

Actual result:
--------------
<form method="post" 
      action="http://www.default.com";>
 <input type="hidden" 
        name="myaction" 
        value="someAction">
 <input type="submit" 
        value="Just do it!">
</form>


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


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

Reply via email to