|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-02-10 20:08 UTC] tony2001@php.net
[2005-02-19 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 14:00:01 2025 UTC |
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>