Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nogepog's avatar

pass current id and date from table submit button

I am trying to pass userid and date of the row where the submit button is selected.But when i press submit on one of the rows the data being passed is of all the rows present.How do i send selected row to the controller's store method

https://jsfiddle.net/8z4r75ua/

0 likes
3 replies
vandan's avatar

may be try this

<button type="submit" name="print" value="1"> Submit </button>

controller file

public function print(REQUEST $request,$id)
{
    if(Input::get('print'))
    {
        //your code
    }

    return \Redirect::route('print',$id); 
}
FareedR's avatar
// blade
<td> 
    <form action = "{{ route('anything', $user->id) }}">
    @csrf
        <input type="date" name="startdate">
        <button type="submit">Submit</submit>
    </form>
</td>

// controller
public function anything(Request $request,$id)
{
    $request->get('start_date');
}

Please or to participate in this conversation.