tags:

views:

27

answers:

3

i am trying this to pass a value to the next PHP page:

    $("#see_comments").attr({href: "comments.php?aid='"+imgnum+"'"});

and in the PHP file I am using:

$aid = $_REQUEST[aid];
echo $aid;

but this is displaying the output like this:

\'9\'

why is this happening? //9 is the value i am passing.

A: 

Because you have magic_quotes enabled in your PHP configuration. Disable that horrible feature now! :P

Nicolás
+1  A: 

Your webserver has magic quotes turned on. They're a terrible thing, and if you can turn them off, I highly recommend you do.

Also, quoting values in your query string is unnecessary. Try this:

$("#see_comments").attr({href: "comments.php?aid="+imgnum});
Lucas Oman
thanks. the quoting in the query string was the problem. that did it. i will try disabling magic quotes as well.
amit
A: 

If the aid parameter is supposed to be an integer, why are you using quotes? Why not just write it like this:

$("#see_comments").attr({href: "comments.php?aid="+imgnum});
Tomas Markauskas