Sending variables in URLs in PHP with echo

Posted by alexpelan on Stack Overflow See other posts from Stack Overflow or by alexpelan
Published on 2010-06-01T18:05:53Z Indexed on 2010/06/01 18:13 UTC
Read the original article Hit count: 210

Filed under:
|
|
|

Hi all,

I can't really find good guidelines through google searches of the proper way to escape variables in URLs. Basically I am printing out a bunch of results from a mysql query in a table and I want one of the entries in each row to be a link to that result's page. I think this is easy, that I'm just missing a apostrophe or backslash somewhere, but I can't figure it out. Here's the line that's causing the error:

echo "<a href = \"movies.php/?movie_id='$row['movie_id']'\"> Who Owns It? </a> ";

and this is the error I'm getting:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

If you could elaborate in your answers about general guidelines for working with echo and variables in urls, that would be great. Thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql