link generator script |
link generator script |
mrlk |
Feb 12 2007, 01:48 PM
Post
#1
|
Group: Members Posts: 1 Joined: 12-February 07 Member No.: 1,873 |
Not sure if this is the rightforum but...)
does anyone know of a link generator script for this: i'm using google maps on joomla and am creating a number of maps - what i would like to do on one main page is have a set of checkboxs/radio buttons so that the user can pick say "towns" & beaches and it would generate the corresponding link on a form button the variables are all numerical eg towns is 1 beaches is 2 bars is 3 etc the result would be /index.php?option=com_google_maps&category=1,2 if the user wanted say towns (1) and bars (3) then the result would be /index.php?option=com_google_maps&category=1,3 basically i need to i think get the variable and add it to the predetermined url and check whether there is anoter var picked, if so add a comma before it, if not then just the variable itself im sure this is far easier than i think but i cant get my head around it |
Effovex |
Feb 13 2007, 05:21 PM
Post
#2
|
Serious Coder Group: Members Posts: 251 Joined: 6-January 07 From: Sherbrooke, Qc, Canada Member No.: 1,477 |
That's fairly easy to do in PHP. Basically, you give all your checkbox the same name with brackets at the end, so for instance
HTML <form action="submit.php" method="post"> <div> <input type="checkbox name="category[]" id="bar"><label for="bar">bar</label><br> <input type="checkbox name="category[]" id="beach"><label for="breach">beachl</label><br> <input type="checkbox name="category[]" id="hotel"><label for="hotel">hotel</label><br> <input type="submit"> </div> </form> CODE <?php $categories = ""; if(!empty($_POST)) for($i; sizeof($_POST["category"]); $i++) if($_POST["category"][$i] == true) $categories .= "$i,"; if(!empty($categories)) header("Location: /index.php?option=com_google_maps&category=$categories"); else do something different if there are no categories. ?> Something like that. Not sure how familiar you are with PHP so maybe that doesn't actually help at all though. This post has been edited by Effovex: Feb 13 2007, 05:23 PM |
Lo-Fi Version | Time is now: 27th April 2024 - 01:11 AM |