Jump to content

Importing lines and returning errors


NLCJ

Recommended Posts

Hello,

I've got two questions. Users can fill in a form with information that has to be in the following format:

Value 1,Value 2,Value 3,Value 4

Value 1,Value 2,Value 3,Value 4

Now I want to return an error if ANY line isn't in that format. For example when it's like this:

Value 1,Value 2,Value 3,Value 4

Value 1,Value 3,Value 4

I've got no clue how to do that...

 

The second question is, how can I get a specific line of the posted information? I've already gotten an answer on how to count those lines, which is working. But I'm going to insert them into the database using a for loop, so I need to insert one row at a time.

 

Thanks for your time and help,

Chris

Link to comment
https://forums.phpfreaks.com/topic/213076-importing-lines-and-returning-errors/
Share on other sites

I've solved it, I suddenly thought of the solution. Weird!  :o

 

I've used:

$postedinfo = explode("\r\n", $_POST['information']);

To get the information, then it can be requested by using:

echo $postedinfo[0]

For line 1, and

echo $postedinfo[1]

For line 2 etc.

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.