PDA

View Full Version : Stupid Error or am I being stupid ?


upirate
03-28-2007, 09:55 PM
$fav="<a href=".str_replace(" ", "+", $_POST[url]).">".$_POST[mysearch]."</a>";

echo $fav;

Nothing gets outputted.

Lynne
03-29-2007, 03:06 AM
One thing that stands out to me is the quotes in the statement. You need to precede the ones you want to keep as quotes with a backslash. So, if you wanted to write:

$fav="<a href="http://this.site.here/">";

you would actually write:

$fav="<a href=\"http://this.site.here/\">";

Dismounted
03-29-2007, 06:57 AM
Spread it out a bit more :). The code is fixed aswell.
$fav = '<a href="' . str_replace(" ", "+", $_POST['url']) . '">' . $_POST['mysearch'] . '</a>';

TECK
03-30-2007, 06:41 AM
There is nothing wrong with his original code (even if not properly formatted), it should still output something, at least an error. :)
echo $fav;
exit;
That will show your code. As a side note, try var_dump() also, is a cool function. :)