Re: getting one line of info at a time
| From: | David T-G | Date: | Mon, 12 Apr 2004 23:02:30 +0000 |
| Subject: | Re: getting one line of info at a time | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33856@lists.php.net to get a copy of this message | ||
Doug --
..and then Hull, Douglas D said...
%
% 1. I have a regular html textarea field for a person to enter in words with a carriage return
after each word. In PHP how would I go about getting one line (or word) at a time? Then I will be
needing to get character by character.
You'll get it all because the user will type in as many entries as he
will and then hit the submit button and it all comes to you.
Or were you thinking of some javascript on your page to do things one
word at a time? [One word about that: YUCK! :-]
If your page looks like
<form action='/path/to/script.php' method='POST'>
Type your words:<br>
<textarea cols='20' rows='4' name='ta'>
</textarea><br>
Now type some words here:<br>
<input type='test' size='20' name='i'><br>
<input type='submit' value='Click!'>
</form>
and you feed
a
b
c
and
a b c
to the fields then your script will have something like
Array
(
[ta] => a
b
c
[i] => a b c
)
for its input. You can just use a foreach to walk through the list, or
explode based on newlines for multiword input, or whatever you need to do.
HTH & HAND
:-D
--
David T-G
davidtg@justpickone.org
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!