Search the Community
Showing results for tags '$_form'.
-
Hi, please, I have a strange problem... I do not know how to solve it, I'm trying for numerous hours... And sorry for my english. I prepared the following synthesis: --- All file in the server root of the web site contain only the statement: <?php require(’server/general.php’); ?> --- general.php basically read an external text file which contains the static html code for that web page identified by - $currentFileName = basename($_SERVER[’PHP_SELF’]); and then print his contents. (This approach allows a fluid management of central contents like the menu or links, particolar issues or appearance, and so on, through a file that contains some meta-informations about the site map) general.php concludes itself setting (in javascript) the html parameters (like input or hinnerHTML): <script> <?php $formParameter = isset($_POST[”u”]) ? $_POST[”u”] : ””; $x = ”xxx”; require(”server/”.$currentFileName); ?> </script> --- Let be that $formParameter isn’t a void value, for example it is ”Pippo”. In the file named ”server/”.$currentFileName, there are these statements: print $formParameter; print $x; // this invalidates javascript, but it is now for php debugging [and, correctly, ouput is: ”Pippo”, ”xxx”] if (!existingValue($x)) { print ”xxxxxxxxxxxxxxx”; writeLog(”x=_”.$x.”_”); clientMessage(...some parameter...); } [and, correctly, no output is done] if (!existingValue($formParameter)) { [And here there is the problem] print ”yyyyyyyyyyyyyyy”; // $formParameter = ”abcdef”; [now it is commented] writeLog(”formParameter is _”.$formParameter.”_”); clientMessage(...some parameter...); } After this if-statement, I print again the parameter: print ”after if: ”.$formParameter; --- prefixing that: 1# the soubroutine existingValue is only: function existingValue($T) { return ( trim($t)!=”” ); } 2# the soubroutine writeLog() write something in a text file 3# clientMessage() soubroutine postpones to a new web page, writing a message for the user , I see that: A# correctly, no print yyyyyyyyyyyyyyy in the last if-statement B# ?!?... writeLog executes! writing in the text file the string ”formParameter is __” C# correctly, not executes clientMessage() soubroutine D# then the flow of the program behaves as if it had never entered if, so it prints the string ”after if: Pippo”. Moreover, if after the statement - print ”yyyyyyyyyyyyyyy”; I uncomment - $formParameter = ”abcdef”; then output of B# became: ”formParameter is _abcdef_”. Why yyyyyyyyyyyyyyy isn’t printed (within the javascript code) but $formParameter is setted? Strange. The flow enters in the if-statement (but it should not do!) and does this only partially? --- Now, really, it isn’t a serious error because the program works equally (see point D#). But I need to understand why exists some aspect of the matter in which $formParameter is evalutated void, because I must make the check of client’s input Note: removing the include and carrying hits contents directly in the parent file (general.php), the problem disappears... but I cannot do this, because general.php has a general role, disconnected from a form-input. THANK YOU FOR YOURS ADVICES