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
https://forums.phpfreaks.com/topic/67766-solved-listing-variables-in-an-array/
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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.