Page 1 of 1

urlencode() breaks URL?

Posted: Thu Jun 22, 2006 9:48 am
by LiveFree
Hey Again,

In the effort to make my blog project core-code totally 100% Valid XHTML (Trans.) I have begun to use urlencode() for links generated with variables for ex:

Code: Select all

$entries.= "<font size='1'><i>Catagory: <a href='#'>$cat_name</a> | Published: $date | ID: $id | # of Comments: <a href='" . $_SERVER['PHP_SELF'] . "?op=view_comment&id=$id" . "'>$num</a></i></font>\n";
Of course that code DOES NOT pass the validation, citing these errors:

cannot generate system identifier for general entity "id".

...'/PostBlog/index.php?op=view_comment&id=1'>2</a></i></font>


But when I add the urlencode( before the $_SERVER and the ) after the $id", I get a 404 not found error even though the path shown on the 404 error matches what it would be without the urlencode

Thanks!

Posted: Thu Jun 22, 2006 9:53 am
by feyd
tried switching & to &?

Posted: Thu Jun 22, 2006 9:58 am
by LiveFree
Ah,
That did it feyd! Thanks :)