Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-24-2006, 08:12 PM
ctrl-alt-del ctrl-alt-del is offline
 
Join Date: Jul 2006
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How Do I Assign Variables From Dropdown Selection - Form Hack

I have the Form Hack installed and have a question that I'm hoping someone can answer with relative ease since I'm not getting a response from the developer. My question happens to be basic PHP/HTML, but since I'm not a developer, I can't figure out the issue.

I'm trying to associate values (numeric) based on a selection of a dropdown. The numeric variable is associated to a thread ID wherease the dropdown selection is a recognizable name.

Here's the default code:
Code:
<select name="dropdownanswer1">
<option value="$dropdownchoice1a" <if condition="$dropdownchoice1a == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1a</option>
</select>
I need to change it to something like:
Code:
<option value="$dropdownthreadID" <if condition="$dropdownchoice1a == $dropdownanswer1">selected="selected"</if>>$dropdownchoice1a</option>
Where:
$dropdownthreadID = 100
$dropdownchoice1a = Monday

These variables are called within a newthread_start plugin.
Code:
//EXISTING THREAD ID FOR FORM TO REPLY IN
$formreplythreadid = "$dropdownanswer1";
Here's the problem: I can't seem to figure out how to call the named variable (Monday) when the form is submitted. Instead, I get the numerical value. Perhaps it's just a simple IF statement I need to add that writes Monday into another variable. However, I can't seem to figure it out.

Any help would be appreciated!
Reply With Quote
  #2  
Old 10-27-2006, 03:26 AM
Chicago_VLNU_4s Chicago_VLNU_4s is offline
 
Join Date: Mar 2006
Location: Chicago
Posts: 453
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

woowww.. and what hack is this originally from?
Reply With Quote
  #3  
Old 10-27-2006, 12:06 PM
ctrl-alt-del ctrl-alt-del is offline
 
Join Date: Jul 2006
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Uhh...read the first sentence.
Reply With Quote
  #4  
Old 10-29-2006, 06:41 PM
Chicago_VLNU_4s Chicago_VLNU_4s is offline
 
Join Date: Mar 2006
Location: Chicago
Posts: 453
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

aww that hack is garbage. I tried it and it made a Generic Form which i couldn't even access
Reply With Quote
  #5  
Old 10-29-2006, 10:26 PM
mr clean's Avatar
mr clean mr clean is offline
 
Join Date: May 2005
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Chicago_VLNU_4s
aww that hack is garbage. I tried it and it made a Generic Form which i couldn't even access
It worked to perfection for me. I don't think I ran into one single problem other than the thread ID/dropdown issue that ctrl-alt-del is speaking of. Certainly not garbage.
Reply With Quote
  #6  
Old 02-13-2007, 06:37 PM
fviper fviper is offline
 
Join Date: Jan 2007
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey Ctrl Alt Del,

You ever have any luck with this? I got the form to work flawlessly http://www.adversaryguild.com/forums...ad.php?do=form,
but I would really like the thread that the reply goes to be based on the reponse of one of the dropdown selections.

I've tried making a hidden field:
Code:
<input type="hidden" name="threadrepid" value="$dropdownanswer1" />
and comparing the "threadrepid to the various answers we are given, and assigning a threadid from there:
Code:
$formreply = "1";
//$formreplythreadid = $posttid;
if ($threadrepid == $dropdownanswer1b)
    {
    $formreplythreadid = "41";
    }
if ($threadrepid == $dropdownanswer1c)
    {
    $formreplythreadid = "42";
    }
if ($threadrepid == $dropdownanswer1d)
    {
    $formreplythreadid = "45";
    }
But no dice. I would be very interested if you had gotten something like this to work - and how.

I even assigned the vars as suggested - so they could be read into the array properly:
Code:
'threadrepid' => TYPE_STR,
$threadrepid = $vbulletin->GPC['threadrepid'];
Any thoughts? I'm not getting very far with the original thread for this hack
Reply With Quote
  #7  
Old 02-13-2007, 07:15 PM
ctrl-alt-del ctrl-alt-del is offline
 
Join Date: Jul 2006
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Since I'm not a programmer, I didn't have much success either so I just did it a redundant and manual way. Here's an example:

Code:
$cust["15"] = "Title 1";
$cust["16"] = "Title 2";
$cust["17"] = "Title 3";

$dropdowncust1 = "15";
$dropdowncust2 = "16";
$dropdowncust3 = "17";
Where ="x" is the thread number.

Then in the form,
Code:
<option value="$dropdowncust1" <if condition="$dropdowncust1 == $dropdownanswercust">selected="selected"</if>>$cust[15]</option>
<option value="$dropdowncust2" <if condition="$dropdowncust2 == $dropdownanswercust">selected="selected"</if>>$cust[16]</option>
<option value="$dropdowncust3" <if condition="$dropdowncust3 == $dropdownanswercust">selected="selected"</if>>$cust[17]</option>
It's ugly, I know.
Reply With Quote
  #8  
Old 02-13-2007, 09:54 PM
fviper fviper is offline
 
Join Date: Jan 2007
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey,

Thanks for the quick reply. I "think" I figured it out after much cussing lol...

I wound up NOT having to declare any new variables, and NOT having to modify the "form" style. All I did was pretty much what I had been working on previously, but called it slightly differently since the calls I was making were causing SQL to panic because of the array usage.

Here's the code if you're interested:

Code:
//ENABLE FORM TO REPLY TO EXISTING THREAD - 1 = yes, 0 = no
$formreply = "1";
if ($dropdownanswer1 == 'Mage'){
$formreplythreadid = "43";}
if ($dropdownanswer1 == 'Warlock'){
$formreplythreadid = "34";}
if ($dropdownanswer1 == 'Warrior'){
$formreplythreadid = "41";}
if ($dropdownanswer1 == 'Rogue'){
$formreplythreadid = "42";}
if ($dropdownanswer1 == 'Priest'){
$formreplythreadid = "40";}
if ($dropdownanswer1 == 'Hunter'){
$formreplythreadid = "46";}
if ($dropdownanswer1 == 'Paladin'){
$formreplythreadid = "45";}
if ($dropdownanswer1 == 'Shaman'){
$formreplythreadid = "44";}
//EXISTING THREAD ID FOR FORM TO REPLY IN
As you can see, I use this form for recruiting purposes for World of Warcraft *grin*. The single quotes and the literal term of what the variable should be were the key apparently. Thanks for all the help - I hope it finds you well =)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:44 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.04004 seconds
  • Memory Usage 2,236KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (9)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete