I'm looking to repopulate some fields when an administrator chooses a different user. I think this can be done through arrays, since by the time it gets to the end computer the PHP has already been parsed, and running a javascript funtion with PHP in it, would ultimately prove fruitless. But what I'm trying to figure out is how to take the array that was built in PHP and pass it (as a global variable?) to the javascript to use and read.
The PHP array is built somewhat like this:
Users(User1(Num ber=>number, FirstName=>name ),User2(Number= >number, FirstName=>name ))
So, since I have the information array within the "Users" array, it makes it that much harder.
If you go to http://beta.eastcoast911.com/ you can see what I'm trying to do. On the top right, when you select a different user, it updates the number with the value, but I'm trying to get it to update the name. On the bottom it has created the table based on the following code:
[PHP]echo "<table width='590px' border=1 cellpadding=0 cellspacing=0>" ;
echo "<tr><th width='5px'>#</th><th>Number</th><th>First Name</th><th>Last Name</th><th>Location </th><th>About</th></tr>";
$dbh = mysql_connect ("localhost" , "name", "password") or die ('Database Connection Error: ' . mysql_error());
mysql_select_db ("db", $dbh);
$sqlArr = 'SELECT Number,FirstNam e,LastName,Loca tion2,About FROM Users ORDER BY "Number" ASC';
$dbsql = mysql_query($sq lArr) or die(mysql_error ());
$row = mysql_num_rows( $dbsql);
for ($i=0; $i < $row; $i++) {
$myarray = mysql_fetch_row ($dbsql);
echo "<tr><td valign='top' align=right>$i. </td>";
for ($j=0; $j < 10; $j++) {
echo "<td valign='top'>$m yarray[$j]</td>";
};
echo "</tr>\n";
};
echo "</table>";[/PHP]
I've used this code for creating the array, and it works as well:
[PHP]for ($i=0; $i < $row; $i++) {
$myArr = mysql_fetch_row ($dbsql);
for ($j=0; $j < 10; $j++) {
$myArr[$i][$j] = $myArr[$j];
};
};[/PHP]
The PHP array is built somewhat like this:
Users(User1(Num ber=>number, FirstName=>name ),User2(Number= >number, FirstName=>name ))
So, since I have the information array within the "Users" array, it makes it that much harder.
If you go to http://beta.eastcoast911.com/ you can see what I'm trying to do. On the top right, when you select a different user, it updates the number with the value, but I'm trying to get it to update the name. On the bottom it has created the table based on the following code:
[PHP]echo "<table width='590px' border=1 cellpadding=0 cellspacing=0>" ;
echo "<tr><th width='5px'>#</th><th>Number</th><th>First Name</th><th>Last Name</th><th>Location </th><th>About</th></tr>";
$dbh = mysql_connect ("localhost" , "name", "password") or die ('Database Connection Error: ' . mysql_error());
mysql_select_db ("db", $dbh);
$sqlArr = 'SELECT Number,FirstNam e,LastName,Loca tion2,About FROM Users ORDER BY "Number" ASC';
$dbsql = mysql_query($sq lArr) or die(mysql_error ());
$row = mysql_num_rows( $dbsql);
for ($i=0; $i < $row; $i++) {
$myarray = mysql_fetch_row ($dbsql);
echo "<tr><td valign='top' align=right>$i. </td>";
for ($j=0; $j < 10; $j++) {
echo "<td valign='top'>$m yarray[$j]</td>";
};
echo "</tr>\n";
};
echo "</table>";[/PHP]
I've used this code for creating the array, and it works as well:
[PHP]for ($i=0; $i < $row; $i++) {
$myArr = mysql_fetch_row ($dbsql);
for ($j=0; $j < 10; $j++) {
$myArr[$i][$j] = $myArr[$j];
};
};[/PHP]
Comment