Results 1 to 8 of 8
Thread: Select DB
Hybrid View
-
16th August 2006 16:22 #1
Select DB
! select . , ( ). : , : Model, SN , Price.
Model select , SN .
, select-a:
. , . .PHP Code:$sql = "SELECT * FROM components";
function database_select($tbl_value, $tbl_label, $select_name, $label, $init_val = "") {
global $sql;
$result = mysql_query($sql);
$menu = "<label for=\"".$select_name."\">".$label."</label>\n";
$menu .= "<td><select name=\"".$select_name."\">\n";
$curr_val = (isset($_REQUEST[$select_name])) ? $_REQUEST[$select_name] : $init_val;
$menu .= ($curr_val == "") ? " <option value=\"\" selected>---------------- -----------\n" : "<option value=\"\">\n";
while ($obj = mysql_fetch_object($result)) {
$menu .= " <option value=\"".$obj->$tbl_value."\"";
$menu .= ($obj->$tbl_value == $curr_val) ? " selected" : "";
$menu .= ">".$obj->$tbl_label."\n";
$result = mysql_query($sql);
}
$menu .= "</select></td>\n";
mysql_free_result($result);
return $menu;
}
echo database_select("Model", "Model", "NewPr", " :");
-
16th August 2006 16:38 #2
. .
javascript.
$menu .= " <option value=\"".$obj->$tbl_value."\"";
value , . onChagne , , .
iframe .
- / . - . , - - . , - ... - .
, .
-
16th August 2006 20:29 #3, -, JavaScript.
Originally Posted by genn
-
17th August 2006 09:36 #4
<select name="menu1" id="menu1" onChange="update_selection();">
- :
<input type="text" name="field1" id="field1">
<head></head> :
<script>
function update_selection( )
{
document.getElementById( "field1" ).value = document.getElementById( "menu1" ).value;
}
</script>
- .
- . , , , ... , javascript- . - :
<body onLoad="init_form();">
</body>
, , , <select> disabled="disabled".
function init_form()
{
document.getElementById( "menu1" ).disabled = false;
}
.... . , div , . , div , . , ...
- ,
-
17th August 2006 11:40 #5
genn, , .
. , , , select . , . : Model, SN, Price. , select, . . insert- ( ) . :
| Model | SN | Price |
|HDD WD-AB | 11111111111111 | 40 |
|CPU Intel.. | 2222222222222 | 120 |
............
select-a, HDD WD-AB, CPU Intel... . HDD- , 11111111111111 (. SN). submit , select- insert- ...
, , - , select ( ).
-
17th August 2006 12:17 #6
, select- , ... , .
.. :
<option value="HDD WD-AD">HDD WD-AD</option>
?
, </option> ... - xhtml , ... <br> <br />




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in