On Jan 2, 2011, at 11:29, Steve Mallett wrote:

> http://localhost/links/add?foo=http://asdfasdf/adsfe/asdf & variations
> thereof work great using
> $foo = $this->params['url']['foo'];
> echo $this->Form->input('Link.url', array('value'=>$foo, 'type' => 'text'));
> 
> However, when hitting http://localhost/links/add the error: Notice
> (8): Undefined index: foo [APP/views/links/add.ctp, line 12]  Should I
> be setting $foo to null somehow?

Certainly, if $this->params['url'] does not contain an element 'foo' you should 
not be attempting to access element 'foo'. This is basic PHP array usage.

if (isset($this->params['url']['foo'])) {
        // do something with $this->params['url']['foo']
} else {
        // do something that does not try to use $this->params['url']['foo']
}


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to