skip to Main Content

there is a menu with 5 select key in my HTML program . By clicking each of these keys a request should send to server . I use ‘a’ tag and href for this . by this approach i have to send request with GET method but i want use POST . For sending request by POST , I use ‘form’ tag for each of these keys . so for 5 key i use 5 ‘form’ tag . Is this a common and acceptable way? haven’t i any better way for sending request with POST? thanks

            <form action="{{url('/defineProject')}}" method="POST" enctype="multipart/form-data">
        {{ csrf_field() }}          
                    <input id="a1" class="s1" type="submit" value="define project">                                      
         </form>
        <form action="{{url('/deleteProject')}}" method="POST" enctype="multipart/form-data">
        {{ csrf_field() }}          
                    <input id="a2" class="s1" type="submit" value="delete project ">                                         
         </form>
        <form action="{{url('/upgradeProject')}}" method="POST" enctype="multipart/form-data">
        {{ csrf_field() }}          
                    <input id="a3" class="s1" type="submit" value="upgrade project ">                                        
         </form>
        <form action="{{url('/reportProject')}}" method="POST" enctype="multipart/form-data">
        {{ csrf_field() }}          
                    <input id="a4" class="s1" type="submit" value="report Project">                                      
         </form> 
        <form action="{{url('/editProject')}}" method="POST" enctype="multipart/form-data">
        {{ csrf_field() }}          
                    <input id="a5" class="s1" type="submit" value="edit project">                                        
         </form>

2

Answers


  1. maybe this is the answer you looking for?
    <form method="POST"></form>

    Login or Signup to reply.
  2. <form method="POST" action="YOUR_BACKEND_URL_ENDPOINT">
        <select name="YOUR_FIELD_NAME">
            <option value="VALUE_1"> VALUE_1_NAME </option>
            <option value="VALUE_2"> VALUE_2_NAME </option>
        </select>
        <button type="submit">Submit form</button>
    </form>
    

    I guess this should work.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search