The php of the php/javascript code below dynamically fills the britishTowns array entries at the server and sends the array along with the rest of the javascript to the client to be further acted upon by the client.
britishTowns = new Array(
<?
while($row =@mysql_fetch_array($resultId))
{
$region=$row['region'];
?>
<? echo("'".$region."'".","); ?>
<? }?>
'END');
However the javascript passed on to the client when executed on the client produces the following formatted code and the client doesn't like the closing comma on the next line and issues the warning 'unterminated string constant'. Why has the array been formatted like this?
britishTowns = new Array(
'ANGLIA1
',
'ANGLIA2
',
'LONDON
',
'MIDLANDS1
',
'END');
However by manipulating the resulting code on the client it is observed that if the formatting is changed as below the code as a whole executes as expected??
I thought javascript was a free formatting language??
britishTowns = new Array('ANGLIA1','ANGLIA2','LONDON','MIDLANDS1,'END');
Can i set up the php/javascript on the server to result in the javascript above on the client after execution of the php/javascript on the server??
please lend me your ears... should that be borrow all i can see at the moment is problems!
Oh Well!
adios.