简体   繁体   English

需要将数据从表转移到另一个模板

[英]Need to transfer data from the table to another template

I have body of my table :我有我的桌子:

<tbody>
@foreach($places as $place)
    @if($place->place_info==0)
        <tr>
            <th scope="row"><input type="text">{{$place->id}}</th>
            <td>{{$place->vagon_type}}</td>
            <td>{{$place->place}}</td>
            <td></td>
            <td>
                <button type="button" onclick="location.href='https://poizd/train_choose/place_choose/Ticket_form'"
                        class="btn btn-outline-primary btn-sm m-0 waves-effect">Купити
                </button>
            </td>
        </tr>
    @endif
@endforeach
</tbody>

I need to transfer data from to another template when I click on button.单击按钮时,我需要将数据从另一个模板传输。 How I can do it.我该怎么做。

You cant send data to another template with out parameter in GET Method or send over POST method您不能在GET方法中使用 out 参数将数据发送到另一个模板或通过POST方法发送

onclick="location.href='https://poizd/train_choose/place_choose/Ticket_form'"

in get method you can send with ?param1=val1&param2&val2 at the end of url or send from form method在 get 方法中,您可以在 url 末尾使用?param1=val1&param2&val2发送或从表单方法发送

<form method="post" action='https://poizd/train_choose/place_choose/Ticket_form'>
   <input type="hidden" name="param1" value="val1">
   <input type="hidden" name="param2" value="val2">
   .
   .
   .
   <button> send </button>
</form>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM