Page 1 of 1

Contencation Problem

Posted: Wed Aug 09, 2006 3:19 am
by Benjamin
Why is this returning 0?

Code: Select all

private function addHiddenValue($name, $value)
    {
        $this->hidden .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />' . $this->lf;
    }

   // from inside another function...
   $x .= '<tr><td colspan="5">' . $this->hidden . $this->lf
        .'<input type="Submit" value="Submit" /></td></tr>' . $this-lf;
        echo "The value of x is $x";
        echo "The value of hidden is $this->hidden";
The value of x is 0
The value of hidden is 0

Posted: Wed Aug 09, 2006 3:32 am
by RobertGonzalez
Did you notice this?

Code: Select all

$this-lf;
Not that this will make it do what you are getting, but maybe...

Code: Select all

private function addHiddenValue($name, $value)
{
    // Make $this->hidden into a string var
    $this->hidden .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />' . $this->lf;
}

Code: Select all

// from inside another function...
// Make the var $x into a sting with a string inside of it
// This assumed that the call to $this->addHiddenValue has already been called
$x .= '<tr><td colspan="5">' . $this->hidden . $this->lf .'<input type="Submit" value="Submit" /></td></tr>' . $this->lf;
echo "The value of x is $x";
echo "The value of hidden is $this->hidden"; // This will only be set if the above method is called before it, no?

Posted: Wed Aug 09, 2006 3:37 am
by Benjamin
Yarrr that fixed it mate. I hate little typo's like that. I've been having a ton of them the last few days. I need a vacation.

Posted: Wed Aug 09, 2006 3:45 am
by RobertGonzalez
At this time of night, erm, morning, especially in BigMo, you have got to expect a missing '>' or two. Of course, for me right now, five cups of coffee and 60 Oz of CocaCola after 8:00PM almost makes those things happen.

Glad you figured it out.

Posted: Wed Aug 09, 2006 5:47 am
by Ollie Saunders
Everah wrote:Five cups of coffee and 60 Oz of CocaCola
Whoa. Ease up on the caffine boi!
What is it with programmers and caffine?

Posted: Wed Aug 09, 2006 10:53 am
by RobertGonzalez
Woke up at 8:30AM yesterday morning. I posted that post at about 1:45 AM the following morning knowing I still had about 45 minutes of work to do then had to get home and unwind before go to sleep. I finally went to sleep at 3:15 AM and, as you can see here, I am posting at 8:45 AM ish. Little bit of sleep needs something to drive it, eh?

Posted: Wed Aug 09, 2006 1:15 pm
by Ollie Saunders
OK Everah. I'm not trying to give you a hard time. I'm just a little concerned really, that kind of stuff isn't good for you. Physcially and mentally. As Jerry Springer says "Look after yourselves and each other" and he's right.