Hello,
I was hoping someone else ran into this problem and knew how to resolve it.
I'm creating a data import feature for a web database application. One of the forms prompts the user to identify the character that separates each value (in the text file). Users are told to enter \t for tab.
When the form field is retrieved, it actually contains "\t", which I'm guessing is part of some security feature. No problem, my code strips slashes before using it:
$fieldDelimiter=stripslashes($_POST['fieldDelimiter']);
Here's the problem:
$dataLine=explode($fieldDelimiter,$importData[$i]);
where $i is in a for loop that reads each line of the text file that was read into an array using the file function.
This results in the entire line being read as one array element in $dataLine. If I hard code "\t" into the explode call, it works as I want. But if the form field value is used, I get just one array element.
Is there something I'm not aware of when using escaped characters in strings that I need to know when working with explode? I've searched the online PHP documentation with nothing useful found.
Any help would be appreciated.
Thanks,
Jack