probably an easy php array question

Posted on 2006-06-30
Last Modified: 2006-11-18
How do I get the text line by line from a textarea box an put it into an array?
Question by:ray-solomon
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

Autogard earned 250 total points
ID: 17021960
You need to create the form on the first page that posts to a second page.

-- First Page --
<form method="post" action="otherpage.php">
<textarea name="mytext">
<input type="submit" name="submitform" />

-- Next Page --

    $textFromBox = $_POST["mytext"];
    # Now it just depends on how you want to split up the text -- I'll do it line by line
    $myArray = explode("\r\n", $textFromBox);


You could also submit to the same page, you would just need to check that there is a value in $_POST["mytext"].
LVL 10

Author Comment

ID: 17021975
Thanks for the quick works

Expert Comment

ID: 17021979
Awesome!  One thing, I forgot to close the </form> on the first page.

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to hide contact form only if no validation errors 4 60
A responsive image gallery using flexbox 6 71
JSON decode 5 40
Securing source code... theoretical question 10 44
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question