Jump to content

[SOLVED] Listing variables in an array


Anzeo

Recommended Posts

Hey all,

 

 

 

I'm currently working on some smaller extra's to add to my site. One of them requires me to input a list (using a form). The list is inputed through a textarea and every new line is seperated by a comma.

 

I'm now trying to figure out how to list all those lines.

 

I've worked out something along the lines of:

$List = $_POST['List'];
$Listarray = array();
list($Listarray[]) = explode(",",$List);
foreach($Listarray as $entry)
{
	echo "$entry";
}

 

But it only list one array element(1 list). Does anyone have an idea on how to list a whole array? (I mean with a variable amount of inputs)

 

 

 

Thanks in advance!

Anzeo

Link to comment
Share on other sites

Hmm no, i'll try to explain my intentions a bit better.

 

I want to create a simple form which would allow me to fill in a list in a textarea the list would be formatted like this:

 

data1,data2,data3,etc...

 

I then need all those data's to be listed so I can work with them seperatly (like inserting them into a DB).

 

But I can't find out how to make a list (to use a foreach statement afterwards) which consits of an unknown variable amount of entries.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.