Reputation: 7731
Trying out Yii2
using the basic app
example, and having some trouble with routing. I have a simple login form, and when submitted the correct controller action is called but the $_POST data is empty. In the Yii debugger, everything looks OK in the logs except this line:
3 18:57:49.307 trace yii\web\Application::handleRequest Route requested: ''
The route is not being handled properly but I don't know what to try next. The 'basic app' comes with a login form view, and the routing is working fine with that form. Here is my form:
<form class="navbar-form navbar-right" role="form" id="du-lts-rm-login-form" method="post">
<div class="form-group">
<input type="text" class="form-control" placeholder="DU ID number">
</div><br>
<div class="form-group">
<input type="text" class="form-control" placeholder="DU Password">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
Here is the full trace:
1 18:57:49.306 trace yii\base\Module::getModule Loading module: debug
2 18:57:49.307 trace yii\web\UrlManager::parseRequest Pretty URL not
enabled. Using default URL parsing logic.
3 18:57:49.307 trace yii\web\Application::handleRequest Route requested:
''
4 18:57:49.307 trace yii\base\Controller::runAction Route to run: site/index
5 18:57:49.307 trace yii\base\InlineAction::runWithParams Running action:
app\controllers\SiteController::actionIndex()
6 18:57:49.307 trace yii\base\View::renderFile Rendering view file:
/home/t/Documents/records/views/site/index.php
/home/t/Documents/records/controllers/SiteController.php (59)
7 18:57:49.307 trace yii\base\View::renderFile Rendering view file:
/home/t/Documents/records/views/layouts/main.php
/home/t/Documents/records/controllers/SiteController.php (59)
The request body is empty, but the routing looks right:
Route 'site/index'
Action 'app\\controllers\\SiteController::actionIndex()'
Also in the response header you can see below that the referer is not correct. Should look like 'https://localhost/records/web/index.php?r=site/index'.
Request Headers
Name Value
host 'localhost'
connection 'keep-alive'
content-length '0'
cache-control 'max-age=0'
accept 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
origin 'https://localhost'
user-agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/32.0.1700.107 Safari/537.36'
content-type 'application/x-www-form-urlencoded'
referer 'https://localhost/records/web/'
accept-encoding 'gzip,deflate,sdch'
accept-language 'en-US,en;q=0.8'
cookie ...
Any help is appreciated.
Upvotes: 1
Views: 991