Friday, December 31, 2010

Re: post form data from URL

On Fri, Dec 31, 2010 at 8:31 AM, Steve Mallett <steve.mallett@gmail.com> wrote:
> Sorry, I thought you were suggesting the routing wasn't needed.  I
> replace it, added your debug code suggestion & this is the result:
>
> URL address: http://localhost/links/add/http://www.youtube.com/watch%3Fv%3DvDVnuFxsfbE
> URL passed to form currently: www.youtube.com
> debug result:
>
> array(8) { ["controller"]=> string(5) "links" ["action"]=> &string(3)
> "add" ["named"]=> array(1) { ["http"]=> string(0) "" } ["pass"]=>
> array(2) { [0]=> string(15) "www.youtube.com" [1]=> string(5) "watch"
> } ["plugin"]=> NULL ["form"]=> array(0) { } ["url"]=> array(2) {
> ["url"]=> string(37) "links/add/http:/www.youtube.com/watch" ["v"]=>
> string(11) "vDVnuFxsfbE" } ["models"]=> array(1) { [0]=> string(4)
> "Link" } }
>
>
> Current routing code:
> Router::connect(
>               '/links/add/:url',
>               array(
>                       'controller' => 'links',
>                       'action' => 'add'
>               ),
>               array(
>                       //Looks for http://
>                                        'url' => '^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$',
>                       // passes it
>                                        'pass' => array('url')
>               )
>        );
> ------------
> add.ctp:
> echo $this->Form->input('Link.url', array('value' => $url, 'type' => 'text'));

A light bulb just clicked on. Instead of calling your param 'url', try
something like 'link', or 'foo', etc. Cake also uses 'url' for routes.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: