すべてのテキストボックスの応答をresults.phpに投稿してから、表示する応答の1つをランダムに選択したいと思います。
フォーム:
<form action="results.php" method="post">
<input maxlength="30" name="friend[]" size="30" type="text" placeholder="Enter an option" />
<input maxlength="30" name="friend[]" size="30" type="text" placeholder="Enter an option" />
<input maxlength="30" name="friend[]" size="30" type="text" placeholder="Enter an option" />
<input maxlength="30" name="friend[]" size="30" type="text" placeholder="Enter an option" />
<input type="submit" value="Submit" />
phpの内容(明らかに間違っていますが、このようなものですか?)
foreach ($_POST['friend'] as $value) {
if ($value) {
echo mt_rand($value);
}
}