FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » pass variable in php construct
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: pass variable in php construct [message #172177 is a reply to message #172174] Thu, 03 February 2011 08:39 Go to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
El 03/02/2011 5:27, Joe escribió/wrote:
> I have these simple lines in my php script:
>
> <?php
> if (!empty($_GET[req])) {
> print "<h2>$_GET[req]</h2>";
> ?>
> <h3>"$_GET[req]"</h3>
> <?php
> } else {
> ...
> }
> ?>
>
> I wonder why the $_GET[req] value shows up within the php code block
> (print to<h2> tags), but not showing up in the html block (between
> <h3> tags)? Is it suppose so or I missed something? (I tried to pass
> it to a local defined variable but still cannot be used in 'html'
> block).

That's the whole point of having PHP blocks. If PHP was parsed and
executed everywhere in the file, why would you need them?

You should also note the difference between 'foo' (a string) and foo (a
constant). I suggest you read the "Language Reference" chapters in the
PHP manual. It explains very important basics about the language:

http://es.php.net/manual/en/langref.php


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help with my website
Next Topic: validating / converting time for insertion into mysql DB??
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 15:07:17 GMT 2024

Total time taken to generate the page: 0.04875 seconds