Is this an html entity problem?

chrismatchett - November 7, 2009 - 19:25

I am using paging on my site and I am trying to ensure the user is returned to the right page after making a purchase.

The problem is using the code below my user is redirected to 'some/file%3fpage%3d1' instead of 'some/file?page=1'?

$strpage = '?page='.$page;
$return_url = $base_url."some/file".$strpage;
$form_state['redirect'] = $return_url;

Anyone any ideas?

Thanks,

Chris

try this

nikitas - November 7, 2009 - 20:04

$strpage ="'?page='.$page";
$return_url = $base_url."some/file".$strpage;
$form_state['redirect'] = $return_url;

. . .
and check this table here http://i-technica.com/whitestuff/urlencodechart.html for the %3f etc. symbols you are getting. . .
where do you run this code?

and something last. . . do you have clear url enabled?cause if u'r running ubercart . . . this is a 'must' and not a optional feature.

more informed question

chrismatchett - November 7, 2009 - 21:23

Thanks, the code example didn't help, but I understand the problem a bit clearer now.

Maybe my question should be how do I make a clean url exception so I can redirect back to a dynamic page that came from a pager e.g. I am paging through a calendar and want the user to be returned to the right calendar page, ?page=whatever, when their selection has been submitted through a form? Clean urls is causing the problem by changing the ? and = on my code.

How do I fix it?

$strpage ='?page='.$page;
$return_url = $base_url."some/file".$strpage;
$form_state['redirect'] = $return_url;

Cheers,

Chris

to answer my own question

chrismatchett - November 7, 2009 - 22:11

To return to the correct page when using pagination, after going through a form, do

$form_state['redirect'] = array($return_url,'page='.$page);

and you shouldn't have any url problems. Passing $page between functions should be straight forward enough.

Chris

ok that will help

nikitas - November 8, 2009 - 18:48

others like you!thanx for sharing. :)

 
 

Drupal is a registered trademark of Dries Buytaert.