How can we use a database to output the corresponding data (which may be a problem to describe )? The current code is attached at the end. If you want to add an office name, you can directly use insert & nbsp; into to enter the officename table. However, here, how does the officename and officecode output the corresponding data through the database (which may be a problem to describe )?
The current code is attached at the end. If you want to add an office name, simply use insert into to enter the table officename.
However, here the officename and officecode are written to death through JS. If you add them in this way, there will be a problem with the corresponding relationship between the two. the newly added data does not have the corresponding officecode. This requires you to manually add it in the js code. it seems unreasonable.
Therefore, I want to read data directly from the database instead of using js. the officename table creates two fields: name and code.
It is feasible to directly read the database and match the two. We recommend that you have an instance. thank you.
Function setofficecode ()
{
// Obtain the value of officename/officecode
Var officename = document. getElementById ("officename"). value;
Var o = document. getElementById ("officecode ");
// Condition determination
If (officename = "XX Office "){
O. value = "101 ";
}
Else if (officename = "YY Office "){
O. value = "201 ";
}
Else if (officename = "ZZ Office "){
O. value = "301 ";
}
}
Script
------ Solution --------------------
Modified
| Office name |
Include ('Conn. php ');
$ SQL = "select * from officename ";
$ Query = mysql_query ($ SQL );
While ($ result = mysql_fetch_array ($ query )){
?>
">
}
?>
|
| Office number |
|