Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Is it possible to validate all the fields of an uploaded CSV file and will display all errors if any of the validations fail using PHP

For example I have a CSV file uploaded by a user which contains these:

Name,Job,Age
John,Clerk,23
Debra,Manager,32
1A3ce,,40a

Validations will be:

If Name contains numeric value, display error to the user
If Age contains non-numeric value, display error to the user
If Age is equal or less than zero, display error to the user
If Job exceeded 15 characters in length, display error to the user
If any of the fields does not have a value or it is blank, display error to the user

How do you do this? I have little knowledge in PHP and at least a guide on how to code this will help me greatly.

What I have tried:

I don't really know how to start coding this.. I really need help.
Posted
Updated 22-Mar-17 23:21pm

1 solution

You first need to learn PHP: PHP 5 Tutorial[^].
 
Share this answer
 
Comments
Member 13078954 23-Mar-17 6:09am    
I have basic knowledge. I just want to ask if this is possible or no?
Richard MacCutchan 23-Mar-17 8:12am    
Possibly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900