Welcome Guest, Not a member yet? Register   Sign In
Add key to header in all page
#10

(12-15-2017, 09:03 AM)Wouter60 Wrote: You can't use a header with the name 'mobile'.
For a complete list of headers, see:
https://developer.mozilla.org/nl/docs/Web/HTTP/Headers

But why do you need a header to pass a value to a model?
You can include the code in the url, like this:

http://website/test/test_value/0910000000

Your controller (test) gets the value as a parameter for the function test_value:
PHP Code:
public function test_value($mobile
{
 
  //Based on the url in the example, $mobile has the value '0910000000';


Or, you can assign a value to a session variable for later use:
PHP Code:
$this->session->mobile '0910000000';
redirect('....'); 

After a redirect to another page, your controller can read the value like this:
PHP Code:
$mobile $this->session->mobile

And then, you can pass this value to your model to check the corresponding data.

I cannot pase field in url because i use header key in all model that i send it from app to api
Finally i decide to use session that you suggest me
Thanks
Reply


Messages In This Thread
Add key to header in all page - by omid_student - 12-14-2017, 04:58 AM
RE: Add key to header in all page - by Wouter60 - 12-14-2017, 11:26 AM
RE: Add key to header in all page - by Wouter60 - 12-14-2017, 02:03 PM
RE: Add key to header in all page - by Wouter60 - 12-14-2017, 10:58 PM
RE: Add key to header in all page - by Wouter60 - 12-15-2017, 09:03 AM
RE: Add key to header in all page - by omid_student - 12-16-2017, 01:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB