SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Phil-man's Avatar
    Join Date
    Nov 2000
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reading Lines from a TEXTAREA Field

    Hi:

    If I were to copy and paste a list of e-mail addresses from a flat text file, with each e-mail address on a separate line, into a TEXTAREA form field, how can I get PHP to make an array of the e-mail addresses? I don't want to do a file upload in this case. And I know how to create an array, but I don't know how to create/populate an array using the lines from a TEXTAREA field.

    Thanks for any help!

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe not the best, but it works.

    PHP Code:
    <?

        
    if($emails) {
            
    $emailList split("\n"$emails);
            foreach(
    $emailList as $key => $email) {
                print 
    "$key = $email\n<br>";
                }    
            }
            
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
        <title>Untitled</title>
    </head>

    <body>
    <form action="<?=$PHP_SELF?>" method="post">
    <textarea name="emails" rows="30" cols="60"></textarea><br>
    <input type="submit" name="submit" value="Submit">
    </form>


    </body>
    </html>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •