Re: [PHP-DB] getting one line of info at a time

2004-04-12 Thread David T-G
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

  
Type your words:


Now type some words here:


  

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
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


RE: [PHP-DB] getting one line of info at a time

2004-04-12 Thread Galbreath, Mark A
Ooops, got lost in the thought

$text_area = $_POST[ "textarea" ];
$str = strtok( $text_area, "\o" );

while( !( $str === FALSE )) {
$text_array[] = $str;
}

for( $i = 0; $i < count( $text_array ); $i++ ) {

for( $j = 0; $j < stlen( $text_array[ $i ]) {
$char = substr( $array_elelment[ $i ], $j );
printf( $char );
}

-Original Message-
From: Galbreath, Mark A 
Sent: Monday, April 12, 2004 5:06 PM
To: 'Hull, Douglas D'; 'Note To php mysql List (E-mail)'
Subject: RE: [PHP-DB] getting one line of info at a time


Find out what the hex is for a carriage return and use strtok() to get an
array of words, then use strlen to get the number of chars in each array
element, and use array_pop() or array_shift(), iterating over the strlen, or
test for NULL for each element in the array..

Mark

-Original Message-
From: Hull, Douglas D [mailto:[EMAIL PROTECTED]
Sent: Monday, April 12, 2004 4:45 PM
To: Note To php mysql List (E-mail)
Subject: [PHP-DB] getting one line of info at a time


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.

2. I will then be searching my database to get matching values in order to
do other things.

But at the moment I am jus trying to figure #1 out.

Thanks for any help.
Doug

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] getting one line of info at a time

2004-04-12 Thread Galbreath, Mark A
Find out what the hex is for a carriage return and use strtok() to get an
array of words, then use strlen to get the number of chars in each array
element, and use array_pop() or array_shift(), iterating over the strlen, or
test for NULL for each element in the array..

Mark

-Original Message-
From: Hull, Douglas D [mailto:[EMAIL PROTECTED]
Sent: Monday, April 12, 2004 4:45 PM
To: Note To php mysql List (E-mail)
Subject: [PHP-DB] getting one line of info at a time


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.

2. I will then be searching my database to get matching values in order to
do other things.

But at the moment I am jus trying to figure #1 out.

Thanks for any help.
Doug

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] getting one line of info at a time

2004-04-12 Thread Hull, Douglas D
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.

2. I will then be searching my database to get matching values in order to do other 
things.

But at the moment I am jus trying to figure #1 out.

Thanks for any help.
Doug

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php