Skip to content Skip to sidebar Skip to footer

Html And Php Concatenation In Url String

Solution 2:

As mentioned in the comments, there is nothing wrong doing it like that but your values could break the query string if they contain characters that need to be encoded.

For example the & and the = have special meanings, so if they could appear in your variable values, they would break the query string.

You can escape individual values using:

... &mov=<?phpecho urlencode($mov) ?> ....

Or you could have php build and encode your string automatically using http_build_query:

$data = array(
  'id' => $id,
  'mov' => $mov
);
$url = 'movie_night_del.php?' . http_build_query($data);

Perhaps the last option is what you were looking for.

Post a Comment for "Html And Php Concatenation In Url String"