Login aith local storage and php link

hi guy

I try to work on a login page that i would to save the username and password for next time on local storage (i use local-storage not SQL ) also i would that username and password send to a php file to authenticate the save it locally .
this how i needed :
username && password ==> send to php to auth ==> get the accept from php side ==> save this username and password into a local storage for the next login
I use an ionic 2 ts
this may code :

public username;
  public password;
  public data;
  public dbUrl = 'http:/xxx/userLogin.php';
  public promos: any;  
  public local : Storage ;
  public  us : any;
  public  ps : any;

  constructor(public nav: NavController, private http: Http,public loginservice : FromService ) {
        this.nav = nav;
        this.http = http;
        this.local = new Storage(LocalStorage);
       this.local.set('username', 'true');

  store(username, password){

  this.local.get('username' && 'password').then((result) => {
//here where i want to send it to php 
      if(//here where i want to send it to php ){
        var  us= this.local.set('username',JSON.stringify(username));
        var ps= this.local.set('password',JSON.stringify(password));

      } else {
        this.local.set('username' && 'password', true);

        var data = JSON.stringify({username: this.username});
        this.http.post(dbUrl,us ,ps)
        .subscribe(data => {
            this.data.response = data._body;
        }, error => {


any help please :blush:

never ever store user uncrypted credentials anywhere!

everyone can access the localstorage and read the data.

You should use something like oauth or jwt-tokens to keep a session valid.