title: Submit form concat two urls when i click on submit button in laravel 8
body: <p>Hello i am new in laravel and the problem is i create two function one for view the edit form and the other function for update the data but when i click on submit it concat view and update both url but in form action i had only gave it the update url.</p>
  <p>Here is my web.php code</p>
  <pre><code>Route::post('addStudent',[StudentController::class,'addStudent'])-&gt;name('addStudent');
  Route::get('/president',[PresidentController::class,'index']);
  Route::get('editPresident/{id}',[PresidentController::class,'presidentEditForm']);
  Route::post('updatePresident',[PresidentController::class,'updatePresident'])-&gt;name('updatePresident');
  </code></pre>
  <p>And this is my controller code</p>
  <pre><code>// view president edit from
      function presidentEditForm($id)
      {
          $userData=$this-&gt;user-&gt;getPresidentById($id);
          return view('president/edit_president',['president'=&gt;$userData]);
      }
      // update president from the admin
      function updatePresident(Request $data)
      {
          $validated = $data-&gt;validate([
              'first_name' =&gt; 'required|max:255',
              'last_name' =&gt; 'required|max:255',
              'email' =&gt; 'required|max:255',
              'mob_no'=&gt;'required',
              'city'=&gt;'required',
              'join_date'=&gt;'required'
          ]);
          // saving inputs into variables
          $firstname=$data-&gt;first_name;
          $lastname=$data-&gt;last_name;
          $email=$data-&gt;email;
          $mob_no=$data-&gt;mob_no;
          $city=$data-&gt;city;
          $password=$data-&gt;password;
          $joiningdate=$data-&gt;join_date;
          $joiningtill=$data-&gt;join_till;
          $userid=$data-&gt;userId;
          // saving into the users object
          $this-&gt;user-&gt;firstname=$firstname;
          $this-&gt;user-&gt;lastname=$lastname;
          $this-&gt;user-&gt;email=$email;
          if($password!=&quot;&quot;)
          {
              $this-&gt;user-&gt;password=$password;
          }
          $this-&gt;user-&gt;joining_from=$joiningdate;
          $this-&gt;user-&gt;joining_till=$joiningtill;
          $this-&gt;user-&gt;city=$city;
          $this-&gt;user-&gt;mobile_no=$mob_no;
  
      }
  </code></pre>
  <p>And this is my view code</p>
  <pre><code>@extends('includes.header')
  @section('content')
  &lt;x-pagetitle data=&quot;Edit President&quot;/&gt;
  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12&quot;&gt;
          &lt;button type=&quot;button&quot; onclick=&quot;back()&quot; class=&quot;btn btn-dark btn-xs btn_back my-2&quot;&gt;&lt;i class=&quot;fas fa-arrow-left&quot;&gt;&lt;/i&gt; Go Back&lt;/button&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12&quot;&gt;
          &lt;div class=&quot;card&quot;&gt;
              &lt;div class=&quot;card-body&quot;&gt;
                  &lt;form action=&quot;updatePresident&quot; method=&quot;POST&quot;&gt;
                      @csrf
                      @foreach ($president as $p)
                      &lt;div class=&quot;row&quot;&gt;
                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 &quot;&gt;
                              &lt;label for=&quot;first_name&quot;&gt;First name*&lt;/label&gt;
                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;first_name&quot; placeholder=&quot;First name&quot; name=&quot;first_name&quot; value=&quot;{{$p['firstname']}}&quot;&gt;
                              &lt;input type=&quot;hidden&quot; name=&quot;userId&quot; value=&quot;{{$p['usr_id']}}&quot;&gt;
                              &lt;div class=&quot;invalid-feedback&quot;&gt;
                                  @error('first_name')
                                      {{ $message }}
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 &quot;&gt;
                              &lt;label for=&quot;last_name&quot;&gt;Last name*&lt;/label&gt;
                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;last_name&quot; placeholder=&quot;Last name&quot; name=&quot;last_name&quot; value=&quot;{{$p['lastname']}}&quot;&gt;
                              &lt;div class=&quot;invalid-feedback&quot;&gt;
                                  @error('last_name')
                                      {{ $message }}
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;row&quot;&gt;
                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 mb-2&quot;&gt;
                              &lt;label for=&quot;email&quot;&gt;Email*&lt;/label&gt;
                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;email&quot; placeholder=&quot;Email&quot; name=&quot;email&quot; value=&quot;{{$p['email']}}&quot;&gt;
                              &lt;div class=&quot;invalid-feedback&quot;&gt;
                                  @error('email')
                                      {{ $message }}
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 mb-2&quot;&gt;
                              &lt;label for=&quot;password&quot;&gt;Password*&lt;/label&gt;
                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;password&quot; placeholder=&quot;password&quot; name=&quot;password&quot;&gt;
                              &lt;div class=&quot;invalid-feedback&quot;&gt;
                                  @error('password')
                                      {{ $message }}
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;row&quot;&gt;
                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 mb-2&quot;&gt;
                              &lt;label for=&quot;mob_no&quot;&gt;Phone No/Mobile No*&lt;/label&gt;
                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;mob_no&quot; placeholder=&quot;Mobile/Phone No&quot; name=&quot;mob_no&quot; value=&quot;{{$p['mobile_no']}}&quot;&gt;
                              &lt;div class=&quot;invalid-feedback&quot;&gt;
                                  @error('mob_no')
                                      {{ $message }}
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 mb-2&quot;&gt;
                              &lt;label for=&quot;city&quot;&gt;City*&lt;/label&gt;
                              &lt;input type=&quot;text&quot; class=&quot;form-control&quot; id=&quot;city&quot; placeholder=&quot;City&quot; name=&quot;city&quot; value=&quot;{{$p['city']}}&quot;&gt;
                              &lt;div class=&quot;invalid-feedback&quot;&gt;
                                  @error('city')
                                      {{ $message }}
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;row&quot;&gt;
                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 mb-2&quot;&gt;
                              &lt;label for=&quot;join_date&quot;&gt;Joining Date*&lt;/label&gt;
                              &lt;div class=&quot;input-group date&quot; id=&quot;join_date&quot; data-target-input=&quot;nearest&quot;&gt;
                                  &lt;input type=&quot;text&quot; class=&quot;form-control datetimepicker-input&quot; data-target=&quot;#join_date&quot; name=&quot;join_date&quot; value=&quot;{{$p['joining_from']}}&quot; placeholder=&quot;Job Start Date&quot;&gt;
                                  &lt;div class=&quot;input-group-append&quot; data-target=&quot;#join_date&quot; data-toggle=&quot;datetimepicker&quot;&gt;
                                      &lt;div class=&quot;input-group-text&quot;&gt;&lt;i class=&quot;far fa-calendar-alt&quot;&gt;&lt;/i&gt;&lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;invalid-feedback&quot;&gt;
                                  @error('join_date')
                                      {{ $message }}
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class=&quot;col-xl-6 col-lg-6 col-md-12 col-sm-12 col-12 mb-2&quot;&gt;
                              &lt;label for=&quot;join_till&quot;&gt;Joining Till&lt;/label&gt;
                              &lt;div class=&quot;input-group date&quot; id=&quot;join_till&quot; data-target-input=&quot;nearest&quot;&gt;
                                  &lt;input type=&quot;text&quot; class=&quot;form-control datetimepicker-input&quot; data-target=&quot;#join_till&quot; name=&quot;join_till&quot; value=&quot;{{$p['joining_till']}}&quot; placeholder=&quot;Job Start Date&quot;&gt;
                                  &lt;div class=&quot;input-group-append&quot; data-target=&quot;#join_till&quot; data-toggle=&quot;datetimepicker&quot;&gt;
                                      &lt;div class=&quot;input-group-text&quot;&gt;&lt;i class=&quot;far fa-calendar-alt&quot;&gt;&lt;/i&gt;&lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class=&quot;invalid-feedback&quot;&gt;
                                  @error('join_till')
                                      {{ $message }}
                                  @enderror
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;row&quot;&gt;
                          &lt;div class=&quot;col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 &quot;&gt;
                              &lt;button class=&quot;btn btn-primary&quot; type=&quot;submit&quot;&gt;Update&lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      @endforeach
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection
  
  </code></pre>
  <p>And this is the error
  <a href="https://i.stack.imgur.com/QTSPa.png" rel="nofollow noreferrer">enter image description here</a></p>