need help

right now im using a java script that sets an array… example below:

<script language="Javascript">
var states = new Array("Alabama","Alaska","American Samoa","Arizona","Arkansas","California",
"Colorado","Connecticut","Delaware","District of Columbia",
"Federated States of Micronesia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois",
"Marshall Islands","Maryland","Massachusetts","Michigan","Minnesota","Mississippi",
"Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico",
"New York","North Carolina","North Dakota",
"Northern Mariana Islands","Ohio","Oklahoma","Oregon","Palau","Pennsylvania","Puerto Rico",
"Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont",
"Virgin Islands","Virginia","Washington","West Virginia","Wisconsin","Wyoming",
"Armed Forces Africa","Armed Forces Americas","Armed Forces Canada",
"Armed Forces Europe","Armed Forces Middle East","Armed Forces Pacific");
new AutoSuggest(document.getElementById('firstname'),states);

can i use php and sql to pull the array and put it in the java ? instead of haveing the manually typed in array

Into JAVA??? I am not sure… Into javaSCRIPT? Absolutely.

Assuming you have all the values in a SQL database, that’s possible yes:

$sql = "SELECT * FROM states ORDER BY name ASC";
$rslt = mysql_query($sql);
echo "<script language="Javascript">
var states = new Array(";
while ($state = mysql_fetch_assoc($rslt)) {
  echo """.$state['name']."", ";
echo ");
new AutoSuggest(document.getElementById('firstname'),states);
Sponsor our Newsletter | Privacy Policy | Terms of Service