Page 1 of 1

Saving Full URL

Posted: Fri Jan 16, 2009 11:04 am
by SheDesigns
My problem is that I need to save a full URL into a database, however, the full address doesn't save.

/?pg=6&function=View&album=Products

Only saves in the database as /?pg=6
It displays it correctly as the full URL when I print it on the page.

Here's the link I provide for them.

Code: Select all

$pageURL = $_SERVER["REQUEST_URI"];
<a href=\"?pg=49&add=$pageURL\">Add this page to Pages I Like</a>
And this is where it's processed.

Code: Select all

$add = $_GET['add'];
$query = "insert into favorites values('', '$add')";
$result = mysql_query($query);
 
Why does it stop at the "&"?

Re: Saving Full URL

Posted: Fri Jan 16, 2009 12:07 pm
by RobertGonzalez
Try escaping the ampersands (or better yet, run all variables that are going to be inserted through an escape function, a la mysql_real_escape_string()).