如何避免从textarea插入空行或空行?

i need help in removing extra line that was created after pasting a value in my textarea,

this code works okay but if there is a blank line added in my textarea its also uploading it into my db, which inturn messed up my db coz its missing the primary key (ars_no) entry so i cant delete it...i need to remove the extra line prior to uploading to db, i tried to use the code below to no avail:

function removeEmptyLines($RemedyTicketNo)
{
return preg_replace("/(^[
]*|[
]+)[\s\t]*[
]+/", "
", $RemedyTicketNo);
}

here is my code to INSERT to db:

require 'include/DB_Open.php';

    if(isset($_POST['DBLoad']))
{
    //print_r($_POST);
    //die();
    $Category2 = $_POST['Category2'];
    $Category3 = $_POST['Category3'];
    $Status = $_POST['Status'];
    $Date = $_POST['Date'];
    $Severity = $_POST['Severity'];
    $BanType = $_POST['BanType'];
    $XiD = $_POST['XiD'];
    $Ticket = $_POST['Ticket'];

    //Process the input textareas into arrays
    $PhoneNumber = array_map('mysql_real_escape_string', explode("
", $_POST['PhoneNumber']));
    $Createdate = array_map('mysql_real_escape_string', explode("
", $_POST['Createdate']));
    $RemedyTicketNo = array_map('mysql_real_escape_string', explode("
", $_POST['PhoneNumber']));

    //Determine the values with the least amoutn of elements
    $min_count = min(count($PhoneNumber), count($Createdate), count($RemedyTicketNo));

    //Create array to hold INSERT values
    $values = array();

    //Create the INSERT values
    for($index=0; $index<$min_count; $index++)
    {
    $values[] = "('{$RemedyTicketNo[$index]}','{$PhoneNumber[$index]}','{$Createdate[$index]}',
    '$Category2','$Category3','$Status','$Date','$Severity','$BanType','$XiD')";   
    }

    if (isset($RemedyTicketNo)) 
    {
    $sql="INSERT into tbl_main
    (ars_no,phone_number,create_date,category_1,category_2,status,resolved_date,trouble_type_priority,ban_type,employee_id_name)
    VALUES " . implode (',',$values); 
    $result=mysql_query($sql);

    header("Location: smp_backend.php");
    }
}