vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   need help with print_select_row (https://vborg.vbsupport.ru/showthread.php?t=318765)

sodagod 05-22-2015 04:20 PM

need help with print_select_row
 
I am trying to get the selected option, but it always returns a number.

here is how i did it.

PHP Code:


$array 
= array("option 1","option 2","option 3""option 4","option 5"); 

print_select_row('title''get_select'$array);

$vbulletin->input->clean_array_gpc('p', array(
        
'get_select' => TYPE_ARRAY
)); 

$get_select =  $vbulletin->GPC['get_select'];

echo 
$get_select

this always results in the number of selected option, I also tried type_array as type_str and that didnt work.

kh99 05-22-2015 04:47 PM

You can either use the number returned as a key to the array, so that the last line in your example might be:
PHP Code:

echo $array[$get_select]; 


Or else you can make the array keys the values you want to get back, like:
PHP Code:

$array = array("option 1" => "option 1","option 2" => "option 2","option 3" => "option 3","option 4" =>  "option 4","option 5" => "option 5"); 

I'd probably go with the first one if you can because if you use the same text you display you might run it to problems if it contains punctuation or something. If the choices are simple strings then it probably doesn't matter. Actually it might not matter either way, I guess it's just that I would do it the first way because I'm not sure.

sodagod 05-22-2015 05:32 PM

first option works better, i tried that before, but I wasn't using the array value.


All times are GMT. The time now is 10:15 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00906 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete