Jump to content

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.