vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   makechoosercode question (https://vborg.vbsupport.ru/showthread.php?t=101028)

DiscussAnything 11-17-2005 07:35 PM

makechoosercode question
 
This is for vb 2.3.x in case it matters.

I have 2 tables, one with the id's and values for the dropdown entries. The other is the table the value is saved to.

The table that populates the dropdown has fields 'id' and 'name' The choosercode is as follows:

PHP Code:

makechoosercode("State/Country","state","states"$primoaddy['state']); 

state is the field it is being saved to
states is the table it gets the values from

So far so good, this part works. It does save the 'id' to the target table though, and not the name of the state/country. But I'm guessing that's still how it's supposed to be.

Next part is where I'm confused. This is where I compile a list of members' addresses (the ones that put it in anyway). The search option it looks like this:

PHP Code:

  doformheader("address","findstate");
  
maketableheader("Find Member - By State");
  
makechoosercode("State:","state","states",-1,"Any"); 

It's getting the names just fine and populates the search-dropdown as expected.

BUT, when the results come up, it shows the state id, and not the state name. I'm displaying $fas[state] .

The question is: On the results, is there any way to have the name field show up instead of the id? I can't imagine I did anything wrong particularly since everything else works as expected. So am I doing something wrong, or is there any way I can have it show the results that actually mean something, rather than just a number?

Thanks in advance :)

Marco van Herwaarden 11-17-2005 07:51 PM

$states["$fas[state]"] maybe?

DiscussAnything 11-17-2005 09:27 PM

That just gives errors. Without quotes or with single quotes it still doesn't like it :(

Guess one option would be to just replace the id's with actual state names and countries, right? As long as it's unique there shouldn't be a problem doing that... Nothing else uses that table and i'm the only one populating it, so...

that would work right?

Marco van Herwaarden 11-18-2005 05:08 AM

Sorry i have no knowledge of vB2 and without seeing more of your code (where is $fas defined) i cant help you more.

DiscussAnything 11-18-2005 11:39 PM

Dank je Marco, but I figured it out. By changing the values in the tables I was able to get the results I was looking for, without too many php changes.

Doei :)


All times are GMT. The time now is 02:09 AM.

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.03125 seconds
  • Memory Usage 1,720KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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