Jump to content

RedirectToURL from include not working


TIP93

Recommended Posts

I have a template in page.php in which I like accessing pages like this:



$podstr = basename(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));

if($podstr==''){include "pages/index2.php";}
elseif($podstr=='registration'){include "registration.php"; }
elseif($podstr=='login'){include "pages/login.php";}
else echo 'ERROR 404';

It basically takes text in URL after the last slash and I therefore I can use nice URLS such aswww.mydomain.com/registration


I also have a registration form in reg.php. The form (if filled in correctly) redirects to ok.php, especially www.mydomain.com/ok



if(isset($_POST['submitted']))
{
if($fgmembersite->RegisterUser())
{
$fgmembersite->RedirectToURL("ok");
}
}

If I open www.mydomain.com/reg.php (which is without my template of course), everything works perfectly!


If I open www.mydomain.com/registration. The form does not save any data to my database and redirects me do index.php.


Do you have idea where the problem might be?


Thank you very much!


Link to comment
https://forums.phpfreaks.com/topic/296507-redirecttourl-from-include-not-working/
Share on other sites

When it "doesn't work", what exactly does happen? Do you get your error 404 message?

 

When one types in "..../registration" how does one get to 'page.php'? Did you replace 'index.php' as your default home page?

 

Did you try to do some echoes to see where you are ending up?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.