lundi 28 mai 2018

How can i submit form keeping existing query string intact in url in laravel

I have a URL something like this : foo?country=usa&state=ny and in foo I have a form which gives me values of firstname & lastname and few more with a submit button.

But when i click submit it gives foo?firstname=john&lastname=doe And the other query i.e country and state get disappear or in other word i am losing them.

Can anyone please tell me how can i peserve them even when i am submiting a form ?

Please note: I can not use any hidden field because there are many forms in foo blade as well as as there can be many query that can come to foo blade not just country and state, there can be age, zipcode etc.

My form in foo.blade.php is like this

<form method="get" action ="">
   <div class="form-group">
      <input type="text" class="form-control" name="firstname" placeholder="first name">
    </div>

    <button type="submit" class="btn btn-green-small">Apply</button>
</form>

    //Another form
 <form method="get" action ="">

       <div class="form-group">
          <input type="text" class="form-control" name="lastname" placeholder="first name">
           </div>
        <button type="submit" class="btn btn-green-small">Apply</button>
    </form>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire