Posted by chrismatchett on November 7, 2009 at 7:25pm
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
Comments
try this
$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
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
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
others like you!thanx for sharing. :)