I have a form with a textarea and a submit button. What I'd like to do is add one word per line in the text area and when the form is submitted I'd like to go through each word, join it randomly with another.
So for example if I submit this:
word1
word2
word3
word4
the result could be something like this:
word3word4
word1word2
word4word1
etc.
So far I have the form:
<form action="index.php" method="POST">
<textarea rows="5" name="strings" id="strings"></textarea><br /><br />
<input type="submit" value="submit">
</form>
I store use submission in a variable like this:
$strings = $_POST['strings'];
$stringsArray = explode("\n", $strings);
I was thinking using the foreach loop but I'm not sure how to display only 2 words per iteration.