Hi
thanks for the reply. But i hv already done what you hv sent me....
my csv contains firstname,lastname,email id. So i have to validate the
email and not allow specialchar other than @. The following is my code.....
if($_REQUEST['submit'])
{
$errmsg="";
$contents = file ('./email_entries.csv');
for($i=0; $i<sizeof($contents); $i++)
{
$line = trim($contents[$i],'",$#!%&^*()');
$arr = explode(',', $line);
if(!$arr)
{
$errmsg.='Invalid CSV file! Please check again.';
}
else{
$sql = mysql_query("insert into employees(first_name,last_name,email_id) values ('".$arr[0]."','".$arr[1]."','".$arr[2]."')");
}
}
}