Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
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  
Old February 12th, 2004, 07:57 AM
ocptime ocptime is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 ocptime User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old February 12th, 2004, 07:59 AM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: JavaScript array append and PHP

yes please post your code relevent to the problem.

Reply With Quote
  #3  
Old February 12th, 2004, 08:04 AM
ocptime ocptime is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 ocptime User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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>

Reply With Quote
  #4  
Old February 12th, 2004, 08:40 AM
ocptime ocptime is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 ocptime User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #5  
Old February 12th, 2004, 08:51 AM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
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.

Reply With Quote
  #6  
Old February 12th, 2004, 09:00 AM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: JavaScript array append and PHP

cool, glad you got it worked out, so sorry iw as slow responding.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > JavaScript array append and PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway