tdothost
01-23-2006, 12:19 AM
I am trying to print and javascript index to an array via php to the browser.
I used the echo and printf command in php, but when I do a view page source in the browser the everything shows fine except for the [ 'left bracket of the index' which shows as [
I appreciate any ideas as of what to look for.
Thanks.
tdothost
01-23-2006, 12:23 AM
it shows as ampersant #91;
realwebsolution
01-23-2006, 12:39 PM
Show me your PHP code please.
azizny
01-23-2006, 06:14 PM
Show me the mooooooney..
I mean your php code :D
Peace,
tdothost
01-23-2006, 10:04 PM
here is the code. note where i do echo thecontents[.
this is not showing the content when i pick the drop down name.
when i do 'view source' from the browser i get:
thecontents & # 9 1 ; 0]='Albania\t\t\t011355\t\t0.36'
thecontents & # 9 1 ; 1]='Algeria\t\t\t011213\t\t0.22'
i should get [ instead of " & # 9 1 ; ". ( here, i inserted a space between each letter in between the quotes, because if i don't it will be repaced with a [ )
is this a setup issue? thanks.
<script language="JavaScript">
var thecontents=new Array()
<?
$tok='';
foreach ($sub_array as $line => $val ){
$new_tok = strtok($val, ":");
if($tok != $new_tok ){
if($tok!=''){
echo $tok4."'\n";
}
echo "\n thecontents[".$new_tok."]='";
} else {
echo $tok4.'\n';
}
$tok2 = strtok(":");
if($tok != $new_tok ){
echo $tok2.'\t\t\t';
} else {
echo $tok2.'\t\t';
}
$tok3 = strtok(":");
echo $tok3.'\t\t';
$tok4 = strtok(":");
$tok = $new_tok;
}
echo "'\n";
?>
//don't edit pass this line
function changecontent(which){
document.ddmessage.contentbox.value=thecontents[which.selectedIndex]
}
document.ddmessage.contenatbox.value=thecontents[document.ddmessage.selectbox.selectedIndex]
</script>
LinuxMaster
01-23-2006, 10:45 PM
http://www.tizag.com/phpT/arrays.php