Skip to content

Core\Response

Fariz Luqman edited this page Jan 22, 2017 · 3 revisions

Responsible for returning user input ($_GET and $_POST).

Getting user input

Use the method Response::get('variable_name'); to get GET and POST data.

Say that you have the form below:

<form method="POST" action="myform">
   <label>My Name Is:</label>
   <input type="textbox" name="myname"><br>
   <label>My Age Is:
   <input type="textbox" name="myage">
   <input type="submit" value="Submit">
</form>

And say you have your route (in routes/web.php) set to this:

Router::post('myform', 'Controller\Form@getDetails');

On your controller, you can do this:

namespace Controller;
use Core\Response;
class Form {
  public function getDetails()
   {
       echo Response::get('myname');
       echo Response::get('myage');
   }
}

Redirecting to a page

Use the method Response::redirect('any/location'); to redirect to a page.

Visit our website for tutorials: stupidlysimple.github.io

Clone this wiki locally