PHP在一个页面中循环多个表单并立即提交

时间:2018-03-18 14:31:23

标签: javascript php html laravel submit

您好我还在学习如何在PHP编程方面做得很好,我已经找到了解决我的问题的解决方案,但仍然无法解决。问题如下所述。

我正在为这个项目使用laravel框架,我想向不同的收件人发送不同的电子邮件,我的方式是使用带有循环的页面,如下所示 enter image description here

  <script>
    //auto submit form
    document.getElementById('sendemail').submit(); // SUBMIT FORM
  </script>
@foreach ($users as $user)

<?php
$count_emps += count($user->id);
for($i=0; $i<=$count_emps; $i++){
  }
?>

  <form id = "sendemail" class = "form-horizontal" role = "form" method = "POST" action = "{{ url('/tms/sendemail/send') }}">
  {!! csrf_field() !!}
    <div class = "container">
      <label for = "receiver">To: </label>
      <input id = "count" type = "text" name = "count" value = "{{ $i }}" class = "form-control">
      <input id = "receiver" type = "text" name = "receiver" value = "{{ $user->id }}" class = "form-control">
      <input type = "submit" value = "Send">
    </div>
  </form>


@endforeach

现在的问题是我不让每个表单运行,以便从显示的表单中获得3个不同的电子邮件。请帮忙,谢谢。

0 个答案:

没有答案