Sending combobox data as variables to php

  • starqueen
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 07, 2004
  • Posts: 122
  • Status: Offline

Post June 6th, 2004, 12:54 am

Trying to create a complicated email form in flash. I know all the input text fields can have var assigned to them, but the component combobox cannot. Can it's instance name work the same way? or How can I make each data entry (8 in total) in the combobox be sent as a separate variable to php? How, can I put a variable onto the comobox????

thx :oops:
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 6th, 2004, 12:54 am

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post June 6th, 2004, 6:18 am

Yep, assign the comboBox an instanceName and collect data like so,

to store all items in an array, (of course you can swap the array with a loadVars() )
Code: [ Select ]
labelArray = new Array();
dataArray = new Array();
for (i = 0; i < comboBox.getLength()-1; i++) {
   labelArray[i] = comboBox.getItemAt(i).label;
   dataArray[i] = comboBox.getItemAt(i).data;
}
  1. labelArray = new Array();
  2. dataArray = new Array();
  3. for (i = 0; i < comboBox.getLength()-1; i++) {
  4.    labelArray[i] = comboBox.getItemAt(i).label;
  5.    dataArray[i] = comboBox.getItemAt(i).data;
  6. }

to get the selectedItem,
Code: [ Select ]
var selectedLabel = comboBox.getSelectedItem().label;
var selectedData = comboBox.getSelectedItem().data;
  1. var selectedLabel = comboBox.getSelectedItem().label;
  2. var selectedData = comboBox.getSelectedItem().data;


:D
Strong with this one, the sudo is.
  • starqueen
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 07, 2004
  • Posts: 122
  • Status: Offline

Post June 6th, 2004, 12:34 pm

Ahh great!! Thanks :D
  • starqueen
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 07, 2004
  • Posts: 122
  • Status: Offline

Post June 6th, 2004, 4:16 pm

well, I can't get it to send into the php though, what am I doing wrong? On the button I have the code set like this:

Code: [ Select ]
on (release) {
    
    labelArray = new Array();
    dataArray = new Array();
    for (i = 0; i < comboBox.getLength()-1; i++) {
       labelArray[i] = comboBox.getItemAt(i).label;
       dataArray[i] = comboBox.getItemAt(i).data;
        }
    
    var selectedLabel =    comboBox.getSelectedItem().label;
    var purpose = comboBox.getSelectedItem().data;
    
    form.loadVariables("email.php", "POST");
}
  1. on (release) {
  2.     
  3.     labelArray = new Array();
  4.     dataArray = new Array();
  5.     for (i = 0; i < comboBox.getLength()-1; i++) {
  6.        labelArray[i] = comboBox.getItemAt(i).label;
  7.        dataArray[i] = comboBox.getItemAt(i).data;
  8.         }
  9.     
  10.     var selectedLabel =    comboBox.getSelectedItem().label;
  11.     var purpose = comboBox.getSelectedItem().data;
  12.     
  13.     form.loadVariables("email.php", "POST");
  14. }
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post June 8th, 2004, 5:56 pm

Check my post here http://www.kirupaforum.com/forums/showt ... hp?t=57254 for information on LoadVars() in flash, everything is the same in flash for PHP as it would be in the ASP example.

Also to send the comboBoxs selected items label, give this to one of the Passengers you will learn about in the post. :D

Code: [ Select ]
comboBox.getSelectedItem.label;
Strong with this one, the sudo is.
  • starqueen
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 07, 2004
  • Posts: 122
  • Status: Offline

Post June 9th, 2004, 2:11 am

lol your post was hilarious yet informative. ill try that out... the problem i was having was to send all info at once, so the loadvars should be fine and SO easy.
  • Passerose
  • Born
  • Born
  • No Avatar
  • Joined: Jul 06, 2005
  • Posts: 1
  • Status: Offline

Post July 6th, 2005, 12:26 am

Hello Starqueen,

Any chance you could mail me the fla of the form you created. I'm looking to do exactly the same but can't get my head round the scripting.

Thanks,

Passerose.

passerose@uber-music.com

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 43 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.