str_replace
Posted: Fri Sep 10, 2004 3:20 pm
hello im using the function str_replace but each time it finds something like href="/images/image.gif i want it to be be replaced with href="$_POST[url]/images/image.gif
i tried:
but all of the ( " ) and ( ' ) mess everything up so instead of replacing $_POST['url'] with the correct URL it just replaces it with $_POST[url] so it ends up looking like
i tried:
Code: Select all
<?php
$srch = array('href="/', 'src="/');
$rplc = array('href="/$_POST[url]/', 'src="/$_POST[url]/');
$go = str_replace($srch, $rplc, $content);
echo $go;
?>any ideas how to correct this?src="/$_POST[url]/images/logo.gif"