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

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.