How to URLENCODE url with variables?
Question
I need to URLENCODE this:
<?php echo 'chart.php?api_url=http://0.chart.apis.google.com/chart?'.$chart1title.$chart1type.$chart1size.$chart1barsize.$chart1gridlines.$chart1data.$chart1color.$chart1bgcolor.$chart1visibleaxis.$chart1axislabels.$chart1axisdatascale.$chart1axisranges.'alt="answeredcalls"';?>
And then decode it on the other side. How can I do this???
Solution
'chart.php?api_url=' . urlencode('http://0.chart.apis.google.com/chart?'.$chart1title.$chart1type.$chart1size.$chart1barsize.$chart1gridlines.$chart1data.$chart1color.$chart1bgcolor.$chart1visibleaxis.$chart1axislabels.$chart1axisdatascale.$chart1axisranges.'alt="answeredcalls"');
OTHER TIPS
Generally you won't have to use urldecode()
when accessing $_GET parameters in PHP. It will be, essentially, decoded for you.
The previous answer is a good solution to the encoding part of the question.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow