I was half way on my project. And I tried to put it on live hosting. And now, I encountered a problem that when I use my login page, and submit the form.. It didn`t redirect to any page, instead it returned me the same routing page with a blank content/page.
I have a scenaro..

Which version of slim framework your are using? Any code example?
@dopesong the latest version. slim v3.0
I follow the tutorial of codecourse authentication slim 3.
here is some reference for the videos. https://www.youtube.com/watch?v=RhcQXFeor9g
Yeah, but without code example we won't be able to help you :)
Well, I can give you the code. but where do I start? from routing or the index? .htaccess?
You should try to debug at which part of request you get blank screen. Maybe errors disabled in server and you can't see any?
no. there`s is no errors nor in server errors. the path_for() is good.
Try to add logger and debug steps where it stops. Maybe it even stopped at User::create?
It works perfectly fine. After I submit the button. It created another data in my database. But it still redirect me to the same pages with blank content..
if you get a blank page, you either have no output created or, more likely, a PHP error has occurred.
Do you have the displayErrorDetails setting set to true?
do you have a .htaccess file in the root?
@akrabat yes~! I set it into true.. .. It was perfectly fine in my local before I make it live website.
@rocketpastsix yes, I was following the tutorial of codecourse: Authentication Slim 3
here is some reference videos. https://www.youtube.com/watch?v=RhcQXFeor9g
It was perfectly fine in my local before I make it live website.
@akrabat here is my live website.
http://web-pos.kolwebs.com/login
username: 123123
password: 123123
code for my LoginController.
Try to follow method naming convention. It is pathFor().
@Tpojka Its still not working.
@konskript
You can check the redirects with the Developer tools of your browser. For example with Chrome or Opera.
@froschdesign do you want me to record things? or to see if my login page is working? if its 404 responds?
Here is the image of my screenshot about dev. tools
@konskript
or to see if my login page is working?
Is working after you submitted the button.
@froschdesign yes! Login page is working. Its just that it returns me blank page. And the Url was still in the /login.. This is just my theory, myy problem was redirecting to another page after submitting a form..
Try debugging the old fashioned way.
In postLogin, add echo "here"; exit; immediately after the opening brace. If that works, then move it to immediately before the if (!$verify) { line. If that works, then var_dump() each pathFor call and check that they return the correct string.
@konskript
my problem was redirecting to another page after submitting a form
You should check this with the browser developer tools. There you can see, if a redirect is performed.
@froschdesign Well, sad to say. I`m still not familiar using dev. tools.
@akrabat Ok, Im going to try it..
@akrabat I don`t know if this is the correct way..
See if it does.
The result.
Anyone? I need some help!
White Page means...
How to verify:
How to verify:
@geggleto How to verify it? Should I click the submission form first or after the load of the php?
@geggleto I don`t know what kind of problem it is. Because there is no page display. And in Dev. Tools. It display status 200..
If you don`t mind. Can you try it?
Here is my site.
http://web-pos.kolwebs.com/login
username: 123123
password: 123123
@konskript,
The output after submitting is a 200 OK status with this text in the body:
<!-- <!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<input type="text" name="">
</body>
</html> -->
You can see this if you view source.
@akrabat yeah I know. I inspect element it. And it returns that. I don`t know where is the error. But my theory is that, it has a problem with redirect..
There is no redirect.
Can you please list out ALL of the routes you have defined?
@geggleto
Here is some of my codes of LoginController.php
Here is some routes.
Here is my Home page
Here is some of my forms..
Okay... but I still need all of your routes... that is only a few of them I suspect ;)
Is this project on something like GitHub?
There is clearly a problem in your code and without seeing ALL of it, I doubt I can help further.
@geggleto what do you mean all routes?
Do you mean by this..
Yup, all of them :)
@geggleto Well, this is a project of Authenticate Slim 3 from codecourse. I was trying to use his code to build an app for myself as a start to this micro framework..
I highly suspect that there is a catch-all route that is getting executed instead of your controller one.
What do you mean? Can you elaborate it that even newbie can understand..
There is likely a route like....
$app->post("/{catch:+}");
That is getting executed before your post Login.
Are you uploading your code changes to your production server after you make changes locally.
Well, Im new to this framework. And this is my first time framework.. So I hope if you dont mind, can you tell me more about it? I still have a difficulties on understanding this..
I`m not coding in local right.. I was changing every code in the production stage.
I need you to do 2 things.
1.) All my application routes was in my routes.php
2.) I was coding in production now.
@konskript the recent screenshot you posted lacks some of the routes... please pastebin, or gist your routes.php
@geggleto how to send the gist to you?
Thank you.
At the bottom of that file... remove lines 233 -> all the way to the end and retry plz.
It works. ! Thanks. WOW! It was a stupid of mine.
:D Hooooorayyyy!
Thanks! but there is still a problem. :(
Yeah it doesn't look like its rendering your error message but at least it's redirecting ;) more work for you to do!
@geggleto yeah. Its good now like in my local.Big help!
@geggleto When I submitted my form.. There is this default_timezone_get() and when I change it to set.. and set it to default_timezone_set('Manila/Asia')
it appears me this..
No idea. why are you tinkering with the timezones ?
wait. I will printscreen the first error it made.. It happen everytime I create a new user or a submission form has been trigger..
Okay. Sorry.. My bad. But before my routes.php fix.. It happened that the carbon.php line 172 must set a default timezone.. Well nevermind. As long as it was perfectly fine.. Thank you!
Anyway. Why is that a problem in my routes.php that I commented at the last part?
@konskript you didn't comment out the last part.
You terminated the php page on line 233... which then lead php to output the contents of 234-> before the framework was started.
When it output the contents of the page it sent out the default php headers which includes as status code, and since you cannot RESEND the status code, the 301 is ignored by php since it had already sent the headers, leading to a blank page which is what the content of the lines 234+ ended up being.
Ohhh..I see, thanks for the info.
Sir, @geggleto Do you have any idea about file upload with the use of slim framework, and as well an Ajax with use of bootstrap modal.. I hope you can suggest me some of tutorials related with it..
konscript, the boostrap docs are really good and modals are completely UI.
you can use forms to interact with your API.
You should probably read up about REST API Development.
http://www.restapitutorial.com/
File upload in Slim v3... https://akrabat.com/psr-7-file-uploads-in-slim-3/
@geggleto thanks for the referral..