Html And Php Concatenation In Url String
Whats wrong with this HTML / PHP - just doesnt look right - Is there a better way to concatenate html and php variables into url string ??? $id . '&mov=' . $mov . '">Click here to delete</a>'
//or
echo"<a href='movie_night_del.php?id={$id}&mov={$mov}'>Click here to delete</a>"
//or escaping "
echo "<a href=\"movie_night_del.php?id={$id}&mov={$mov}\">Click here to delete</a>"
Solution 2:
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"