Re: Setting & displaying Variables [message #182860 is a reply to message #182859] |
Sat, 21 September 2013 20:25 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 9/21/2013 4:20 PM, Twayne wrote:
> 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`
>
>
Your code is obviously screwed up. But by posting excerpts of your
code, you make it impossible for anyone to tell you what you screwed up.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|