webCOMAND

request::set_request()

Set the value that will be returned by request(), and potentially get() and post().

If the specified key is associated with an existing POST parameter, only the POST parameter value will be updated or unset.  If no POST parameter exists for the specified key, but a GET parameter does exist, the GET parameter value will be updated or unset.  If neither a POST or GET parameter with the specified key exists, they will both be set, or left unset if the specified value is NULL.

Prototype

string set_request(string $key, string $value = NULL)

Parameters

  • key - Name of the parameter to set.
  • value - Optional parameter with the value to set.  If not provided or NULL, the parameter will be unset.

Return

If the POST parameter was set (always TRUE).

Example

// retrieve the value of the "search" GET parameter, then change it
$request = new \io_comand_web\request();
$original_value = $request->request('search');
$request->set_request('search', 'new');
$new_value = $request->request('search');