Forum Moderators: coopster
I have a simple script which takes a variable sent from a form, and then displays it a few times, in different variations (I use this script for generating Adwords keywords, so if I input the keyword widget, I will get "widget", [widget], etc.
What I want to do is have a Textarea tag instead of text input tag, so I have the ability to put a list of keywords, one on each line, and then the script will output each of the keywords in its variations.
I guess it should be simple, but considering my PHP experience... well, I'll be happy to get some help on this.
By the way, I tried to change the text input to text area but when I type a few lines of keywords, the script treats them like they were one long keyword.
Happy Holidays & Thanks in advance for your help..!
<form name="a" method="POST" action="index.php">
<textarea name="search"></textarea></form><?php
$text = str_replace("\r", "", $_POST['search']);//to process the windows new line
$arrtext = explode("\n", $text);// create array of keywords
foreach($arrtext as $keyword)
{
echo "Keyword is: $keyword<br />";//process the keywords as you like
}
Hope this helps you
Regards
Michal
PS. If you want to input default value into textarea with php:
<textarea name="search"><?php echo $default;?></textarea>