# Getting data into multiple textboxes

**URL:** <https://forum.kirupa.com/t/getting-data-into-multiple-textboxes/278325>\
**Category:** Uncategorized\
**Created:** [December 27, 2008, 11:55am UTC](https://forum.kirupa.com/t/getting-data-into-multiple-textboxes/278325 "2008-12-27T11:55:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gencoglu](https://avatars.discourse-cdn.com/v4/letter/g/898d66/32.png) [@gencoglu](https://forum.kirupa.com/u/gencoglu)\
**Post date:** [December 27, 2008, 11:55am UTC](https://forum.kirupa.com/t/getting-data-into-multiple-textboxes/278325/1 "2008-12-27T11:55:49Z")

</div>

Hi, There,  
The following code works for only one textbox…  
But I need 10 textboxes…and I need to have 10 different questions which are randomly selected  
from my external text file to be placed into ten textboxes…  
every time I click the button questions are supposed to change…  
I know I should have a for loop to achieve that but not sure how to insert it  
in the folowing code .please do me a favor and add a for loop so that I can retrive questions from text file and  
put them into textboxes  
thanks

```php

on(press){
var curQuote:String;
var ranNum:Number;
var ranQuote:LoadVars = new LoadVars();
ranQuote.onLoad = function(success) 
{ if (success) {    
var totalQuotes:Number = 50;
ranNum = (Math.random()*totalQuotes >> 0)+1; 
curQuote = this["qu"+ranNum];  
quote_txt.text = curQuote; }
else
{ 
quote_txt.text = "The text failed to load due to an error";
}}
;ranQuote.load("questionss.txt");
}
 

```
