如何通过电子邮件 Laravel PHP 从表中发送 JSON 数据

我想从各种下拉框中完成的 HTML 表中获取所有数据。我能够成功通过电子邮件发送所有输入字段,但无法弄清楚如何获取 JSON 数据。


我已将表数据转换为 JSON,并且变量记录正常。没有后端数据库,所有数据都是客户端和静态 HTML。


HTML


<div class="row">

<h4 class="info-text"> Tell us about yourself and the project you are working on.</h4>

<div class="col-sm-5 col-sm-offset-1">

    <div class="form-group">

        <label>Contact Name <small></small></label>

        <input name="name" type="text" class="form-control" placeholder="Contact Name..." id="name">

    </div>

    <div class="form-group">

        <label>Contact Number <small></small></label>

        <input name="phone" type="text" class="form-control" placeholder="Number..." id="number">

    </div>

</div>

<div class="col-sm-5 ">

    <div class="form-group">

        <label for="project">Please tell us a little about the project you are working on <small></small></label>

        <textarea class="form-control" name="project" rows="5" id="project"></textarea>

    </div>

</div>

<div class="col-sm-10 col-sm-offset-1">

    <div class="form-group">

        <label>Email <small></small></label>

        <input name="email" type="email" class="form-control" placeholder="email@email.com" id="email">

    </div>

</div>

<div class="col-sm-10 col-sm-offset-1">

    <div class="form-group">

        <label>Upload a file should you wish to</label>

        <input name="file" type="file" class="btn btn-info" placeholder="email@email.com">

    </div>

</div>

<table class="table">

    <thead>

        <tr>

            <th scope="col">#</th>

            <th scope="col">Product</th>

            <th scope="col">Ancillary Quantity</th>

            <th scope="col">Fire Rating</th>

            <th scope="col">Void Gap (mm)</th>

            <th scope="col">Cut Type</th>

            <th scope="col">Quantity</th>

            <th scope="col">Bracket Finish</th>

        </tr>

    </thead>

    <tbody>

        <tr>


        </tr>


    </tbody>


</table>

这是用于表格数据的 jQuery 循环


$("#next").click(function () {


var table = $("table tbody");


table.find('tr').each(function (i) {


});


茅侃侃
浏览 149回答 1
1回答

慕尼黑8549860

在您的控制器上使用json_decode()$tableData&nbsp;=&nbsp;json_decode($request->row,&nbsp;true);&nbsp;#&nbsp;true&nbsp;--&nbsp;get&nbsp;as&nbsp;array然后将 $tableData 传递给您的电子邮件刀片并打印。https://www.php.net/manual/en/function.json-decode.php
打开App,查看更多内容
随时随地看视频慕课网APP