Re: [PHP] Customize link
On 5/5/2011 3:38 PM, Michael Simiyu wrote: > Dan, > > thanks for the reply.this is the code that shows/lists the categories > you need to make the following check look at $_GET instead of $_POST. Or, I hate to suggest it, you can use $_REQUEST. It includes $_GET, $_POST, and others all in one variable. > if (isset($_POST['category_'.$c->id])) echo 'checked="checked"'; [snipped] > > i can see the categories ids and i just want to get a custom link for each > category and essentially hide this section from my memebers > > Thanks > > > On May 6, 2011, at 1:28 AM, Daniel Brown wrote: > >> > >> $cat_ids = array(1,3,5,7,13,15,24,36,81,92); >> >> echo ''.PHP_EOL; >> foreach ($cat_ids as $cid) { >> >>echo ' > >>if (isset($_GET['cat_id']) && $_GET['cat_id'] == $cid) { >>echo ' selected="selected"'; >>} >> >>echo '">'.$cid.''.PHP_EOL; >> } >> echo ''.PHP_EOL; >> >> ?> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Customize link
Dan, thanks for the reply.this is the code that shows/lists the categories $cats = $download_taxonomies- >get_parent_cats(); if (!empty($cats)) { foreach ( $cats as $c ) { echo 'id="category_'.$c->id.'" '; if (isset($_POST['category_'.$c->id])) echo 'checked="checked"'; echo ' /> '.$c->id.' - '.$c->name.''; // Do Children if (!function_exists('cat_form_output_children')) { function cat_form_output_children($child) { global $download_taxonomies; if ($child) { echo 'type="checkbox" name="category_'.$child->id.'" id="category_'.$child- >id.'" '; if (isset($_POST['category_'.$child->id])) echo 'checked="checked"'; echo ' /> '.$child->id.' - '.$child->name.''; echo ''; $download_taxonomies- >do_something_to_cat_children($child->id, 'cat_form_output_children', 'cat_form_output_no_children'); echo ''; echo ''; } } function cat_form_output_no_children() { echo ''; } } echo ''; $download_taxonomies->do_something_to_cat_children($c->id, 'cat_form_output_children', 'cat_form_output_no_children'); echo ''; echo ''; } } ?> i can see the categories ids and i just want to get a custom link for each category and essentially hide this section from my memebers Thanks On May 6, 2011, at 1:28 AM, Daniel Brown wrote: '.PHP_EOL; foreach ($cat_ids as $cid) { echo ' '.$cid.''.PHP_EOL; } echo ''.PHP_EOL; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Customize link
If your options are dynamically created you could check the value passed against each option are mark the match with "SELECTED"; Example Static: Echo "5".PHP_EOL; Example Dynamic for($a=1, $a <= 15; $a++) { Echo " ".$a."".PHP_EOL; } Just a though Richard L. Buskirk -Original Message- From: Michael Simiyu [mailto:simiyu.mich...@gmail.com] Sent: Thursday, May 05, 2011 6:10 PM To: php-general@lists.php.net Subject: [PHP] Customize link Hello, Here is the scenario I have a form with the folloing fields i. Title ii. Category (This is a drop down with a list of categories which have id's - am using wordpress ) iii. upload file field now what i want to do is to be able to customize a link like http://www.mysite.com/addfile&cat_id=5 so that when i access the link it has one of the categories in the drop down selected..reason is i dont want users to see the different types of categories So i guess my question is how to configure a meu item in a drop down to be automatically selected in a link... Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Customize link
On Thu, May 5, 2011 at 18:10, Michael Simiyu wrote: > > So i guess my question is how to configure a meu item in a drop down to be > automatically selected in a link... '.PHP_EOL; foreach ($cat_ids as $cid) { echo ' '.$cid.''.PHP_EOL; } echo ''.PHP_EOL; ?> -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php