0

With this link I am trying to open a mail program with the emails they selected before. But I'm stuck with a error which says "people is not defined"

<td>
                <div class="">
                    <label><strong>Select:</strong></label><br/>
                    <select class="custom-select" multiple name="people[]">
                        @foreach($peoples as $person)
                            <option value="{{$person->id}}">{{ $person->e_mail }}</option>
                        @endforeach
                    </select>
                    <a href="mailto:<?php foreach($_POST['people'] as $person){ echo $person;} ?>?subject={{ $document->id }} {{ $document->subject }}&body=Show Document: {{ (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" }}" class="btn btn-info"><i class="fa fa-envelope"></i></a>
                </div>
            </td>
  • It could be that the "people" variable that comes from the POST message is not really defined. Have you tried debugging first? with e.g. xdebug & vscode, that tells you what is in the POST headers along many other things... – lnjuanj Jul 23 '20 at 14:24

1 Answers1

0

You can't do that via PHP, I mean it is possible but not in this case above. PHP is a server-side language and you need to submit a form to fetch POST data. You are searching for frontend language like a JS.

I will point you to see this article to help you better understand what you need to do. How to get multiple select box values using jQuery?

maki10
  • 553
  • 2
  • 11