|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
JavaScript array append and PHP
Pls Help me,i hava func in JS which takes data from database using PHP and first fetch it is working fine and is put in a listbox, second time when i want to append to the listbox it ios not working . but the check variable elCategoryCount is alerting fine.
will send u the func if u want. Thanx inAdvance |
|
#2
|
|||
|
|||
|
RE: JavaScript array append and PHP
yes please post your code relevent to the problem.
|
|
#3
|
|||
|
|||
|
RE: JavaScript array append and PHP
<script language="JavaScript">
function popparent() { var elCategory = parent.document.forms[0].elements[1]; var elCourse = parent.document.forms[0].elements[2]; var elChapter = parent.document.forms[0].elements[3]; var elLearnObj = parent.document.forms[0].elements[4]; if(elCategory.options.length > 0){ var elCategoryCount = elCategory.options.length + 1; }else{ var elCategoryCount = 0; } alert(elCategoryCount); <?php switch ($s) { case 0: $i=0; while($row = $rs->fetchRow()) { echo("elCategory[elCategoryCount]=new Option('$row[0]','$row[1]');n"); echo ("elCategoryCount++;n"); } break; case 1: $i=0; while($row = $rs1->fetchRow()) { echo("elCourse[$i]=new Option('$row[0]','$row[1]');n"); $i++; } break; case 2: $i=0; while($row = $rs2->fetchRow()) { echo("elChapter[$i]=new Option('$row[0]','$row[1]');n"); $i++; } break; case 3: $i=0; while($row = $rs3->fetchRow()) { echo("elLearnObj[$i]=new Option('$row[0]','$row[1]');"); $i++; } break; } ?> } </script> </head> <body onLoad="popparent();"> </body> </html> |
|
#4
|
|||
|
|||
|
RE: JavaScript array append and PHP
i gotit right, change the code at first echo to:
echo("elCategory[elCategory.options.length]=new Option('$row[0]','$row[1]');n"); it willcorrectly append to the list GoodLuck |
|
#5
|
|||
|
|||
|
RE: JavaScript array append and PHP
what do you have $rs $rs1 $rs2 and $rs3 defined as? Im still a little unclear about what your trying to do? Is this data being pulled from a database? I assume those variables are queries.
|
|
#6
|
|||
|
|||
|
RE: JavaScript array append and PHP
cool, glad you got it worked out, so sorry iw as slow responding.
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > JavaScript array append and PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|