0
votes

My dataentry team searches for records online and then copy paste some records. That goes in my DB and then through PHP code I am generating XLS file to download those records.

I am removing HTML tags from the input records. But from time to time I get some invalid chars because of which XLS file don't open and give an error.What is best solution to overcome this issue. Thanks.

1
welcome to StackOverflow; please review how to ask a good question; please provide a minimal, complete, and verifiable examplelandru27

1 Answers

1
votes

you can remove special characters one by with this short line of code.

<?php
$spl_arr = array("<",">"@","$","!","$");  //put all special char here
$your_string="here !s @ s@ample $tring to remove $ecial char";

foreach ($spl_arr as $value) {
    //$your_string.replace($value,"new_char or blank space");
    $your_string.replace($value,"");
}
//$your_string is now "here s sample string to remove special character"
?>