Article 50Y8P add multiple e-mail address in html form and pass it on to php and execute shell script

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

by
ravir_jbp
from LinuxQuestions.org on (#50Y8P)
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.

html:

<html>

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

<body>

<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 />
</form>
echo " Request submitted successfully";

</body>

</html>

PHP:

<?php
$ENTER_URL = $_POST['ENTER_URL'];
$ENTER_EMAIL = $_POST['ENTER_EMAIL'];

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>";
echo "$ENTER_URL $ENTER_EMAIL";
?>

<?php
// exec("key2.sh "$ENTER_URL" "$ENTER_EMAIL");
$output = exec("./key2.sh $ENTER_URL $ENTER_EMAIL");
echo $output;
?>

shell script

grep -iRl "$1" /SAE/file/TM/ots/download/ | mailx "$2"latest?d=yIl2AUoC8zA latest?i=TaxXX6qprHg:DMzed91Pyaw:F7zBnMy latest?i=TaxXX6qprHg:DMzed91Pyaw:V_sGLiP latest?d=qj6IDK7rITs latest?i=TaxXX6qprHg:DMzed91Pyaw:gIN9vFwTaxXX6qprHg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments