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

Home » Imported messages » comp.lang.php » Setting & displaying Variables
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Setting & displaying Variables [message #182871 is a reply to message #182864] Sun, 22 September 2013 21:19 Go to previous messageGo to previous message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma:
Senior Member
On 2013-09-21 5:29 PM, Richard Yates wrote:
> On Sat, 21 Sep 2013 16:20:49 -0400, Twayne <nobody(at)spamcop(dot)net> wrote:
>
> Probably those three Ms in '$commments'

CRAP!! I can't tell you how many times I looked at that code and didn't
see it!
But, that's all it took was to spell the var correctly, of course. I
am severely humbled and owe you a drink at the local bar were it
possible, or some other thing you'd appreciate if you're not a drinker!
Any chance you live in far upstate NY?

Regards,

Twayne`



>
>
>> Hi,
>>
>> Obviously, the issue is around the comments var. It works, but it
>> doesn't and I'm hoping someone can explain why.
>>
>> Both echo strlen($comments); and echo $comments; throw a Notice
>> about an undefined variable. But the variable "comments" HAS to have
>> been defined in order for the two echo statements to work!
>> The variable 'comments' is also in SESSION data, which will also get
>> the same Notice of an undefined variable.
>>
>> What the heck am I missing? Why do I get the undefined var in those two
>> statements?
>>
>> ===================
>> <code>
>> echo strlen($_POST["comments"])."<br />"; //WORKS
>>
>> $commments = $_POST["comments"]; // WORKS but not needed; done elsewhere
>> too.
>>
>> // echo strlen($comments); // GETS Notice: Undefined variable: comments
>> in C:\xampp\htdocs... and nothing displays.
>>
>> echo $_POST["comments"]; // WORKS
>> //echo $comments; // GETS Notice: Undefined variable: comments in C
>> ... and nothing displays.
>>
>> </code>
>> ===================
>>
>> I'm obviously missing something here since it appears the var is set
>> according to the 2 statements that do display what I expected. Can you
>> straighten me out? I've had this happen before with other vars and it's
>> always confusing.
>>
>> TIA,
>>
>> Twayne`
>>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: test for file existance
Next Topic: mail working, not working.
Goto Forum:
  

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

Current Time: Tue Nov 26 18:59:36 GMT 2024

Total time taken to generate the page: 0.04682 seconds