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 #172214 is a reply to message #172176] Fri, 04 February 2011 15:42 Go to previous messageGo to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(Curtis Dyer)

> Joe <juliani(dot)moon(at)gmail(dot)com> wrote:
>
>> I have these simple lines in my php script:
>>
>> <?php
>> if (!empty($_GET[req])) {
>
> You need quotes around ``req''.

Yes.

>> print "<h2>$_GET[req]</h2>";
>
> Here, too.

No. Note the double quotes around the string. Quotes around the array
key are not allowed here, unless you use curly syntax. So both of these
ways are correct:

print "<h2>$_GET[req]</h2>";
print "<h2>{$_GET['req']}</h2>";

Micha
[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: Fri Sep 20 13:21:36 GMT 2024

Total time taken to generate the page: 0.04419 seconds