note 44456 added to function.include

From: Date: Fri, 06 Aug 2004 16:44:09 +0000
Subject: note 44456 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-79942@lists.php.net to get a copy of this message
Hello, I found away to turn over this, it was like this strings.php ----------- switch ($msg_id) { case 001 : echo "test";break; case 002 : echo "test2";break; ....} index.php ------------ <script type=javascript> msg = '<? $msg_id = 001; include "strings.php"; ?>'; alert(msg); </script> ................... Alert doesn't work, because of an additional LF which has been added by include, so I've changed the code as the follwing strings.php ----------- switch ($msg_id) { case 001 : return "test"; case 002 : return "test2"; ....} index.php ------------ <script type=javascript> msg = '<? $msg_id = 001; echo include "strings.php"; ?>'; alert(msg); </script> --------------- so workss .. good luck , am I right anyway ?????????,, ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44456 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44456&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44456&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79942) next »