Jump to content

Recommended Posts

i have the following code

[code]<select  size="10" id="templateList" name="templateList" onchange="<?php $a = strtoint(templateList.value);
print $templateList>value;
    echo 'displayTemplate('.$templateArray[$a][1].',MessageTemplate)';

?>

">;

<?php
  print $numberOfTemplates;
  for ($i=0 ; $i<$numberOfTemplates; $i++){
 
print '<option value="'.$i.'">'.$templateArray[$i][0].'</option>';
  } 
 
  ?>

                        </select>                [/code]

Specifically in this bit of code :

[code]
$a = strtoint(templateList.value);
[/code]

the templateList.value is not actually passing the value, it is just passing the text templateList.value. could someone please help, it should be passing the actual value of templateList.valuewhich is "0" or "1" or somthing like that,

thanks
nooo the templateList.value is the value of the listbox,

i have a listbox and a text area, depending on what is selected from the listbox, a different message will be shown in the text area,

to get what has been selected from the listbox i use templateList.value, which is the name of the listbox, and the . value bit returns the value of which option has been selected, i can get this number to print out into the text box, but i dont want the number, i want to use the number to select thr right peice of text from an array

i hope this makes sense,

or if there is another way around what i am trying to do

my array is in php and therefore i think i need to use php in this bit
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.