How can I do this so it works $cost$id = $_GET[‘cost$id’];
I need it so it pulls something like this from the url: cost1=games,cost2=tops
My form is populated using mysql.
How can I do this so it works $cost$id = $_GET[‘cost$id’];
I need it so it pulls something like this from the url: cost1=games,cost2=tops
My form is populated using mysql.
Try this:
<?php
// $url = 'http://www.example.com?cost1=games&cost2=tops';
$cost1 = isset($_GET['cost1']) ? $_GET['cost1'] : '$cost1 - HAS NOT BEEN SET!!!';
$cost2 = isset($_GET['cost2']) ? $_GET['cost2'] : '$cost2 - HAS NOT BEEN SET!!!';
echo '<br />$cost1 ==> ' .$cost1;
echo '<br />$cost2 ==> ' .$cost2;
// output
$cost1 ==> games
$cost2 ==> tops';
?>
Please note that in your example the parameters are separated by a comma which should be an ampersand.
Thanks will give it a try.