Add multiple e-mail address in html form and pass it on to php and execute shell script

I have created HTML and php page which execute the shell script. In the current script I can submit one e-mail address at a time to execute the script. However, I would like to add multiple e-mail address (comma or space separated) from html and execute the script. Also like to send flash message " you requst has been submited" on the html page so that user should not click on submit button multiple times.



    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>remote and upload reports </title>
<link href="stylesheets/common.css" type="text/css" rel="stylesheet">


    <h1>Remote and upload document report</h1>

    <form method="post" action="script2.php">

        Enter URL : <br />
        <input type="text" name="ENTER_URL" size="35" />
        <br />
        Enter e-mail address : <br />
        <input type="text" name="ENTER_EMAIL" size="35" />
        <br />

        <input type="submit" value="Submit" />
        <br />
        echo " Request submitted successfully";



PHP script:


if (empty($ENTER_URL)|| empty($ENTER_EMAIL)) {
    echo "<h2>You must fill in all fields</h2>\n";
    die("Click Back to start again.");

echo "<h2>The request has been processed and will get the e-mail notification soon</h2>";
echo "<b>You have entered following URL and e-mail address:</b><br><br>";

// exec(" \"$ENTER_URL" \"$ENTER_EMAIL");
$output = exec("./ $ENTER_URL $ENTER_EMAIL");
echo $output;

SHELL script

grep -iRl "$1" /SAE/file/TM/ots/download/ | mailx "$2"