had a search for advice on this, but i'm still confused so here goes.
i've got a simple news script running that explodes data from a .txt file:
<?php
$data = file('news/news.txt');
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo "<div class=\"date\">\n" .
$pieces[0] . "\n</div>\n" .
"<div class=\"news\">\n" .
$pieces[1] . "\n</div>\n<br>\n\n";
}
?>
when using my form to submit data to news.txt, if i use an apostrophe it precedes it with a forwardslash.
eg:
25.08.04 , 11.36|what\'s up, doc?
i want to use the str_replace function to get get rid of the forwardslash, but i'm not entirely sure how to go about it.
i know it should look something like this:
str_replace("\\","",$pieces[1]);
but i don't know where to place that code within my existing code...can anyone help? or if there's a way to stop the forwardslash being added in the first place that would be great...thanks