组合框/文本框php mysql [英] combo box / text box php mysql
问题描述
这是代码,现在这里是最终结果....我得到一个组合框
和
一个tex盒出现,但它们是空...
DAMN !!!
关于我做错了什么的想法请...
再次感谢
<?php require_once(''.. \ library_database\Connections\onli nequote.php''); ?>
< ;?
函数select_cases_price()
{
$ qy = SELECT SellingPrice,Description FROM cases;
$ rs = mysql_query($ qy)或die(mysql_error());
while(mysql_fetch_array($ rs))
{$ select。="< option value =''{$ r [0]}''> {$ r [0]}< / option> \ n" ;;
$ price [] = $ r {1};
}
返回数组($ select,$ prices);
}
?>
在您的网页上,调用该功能。
< ;? list($ select,$ prices)= select_cases_price(); ?>还有一点JS:
< script>
函数showPrice(){
数组价格(<?echo $ prices?> ;);
var i = document.form.item.selectedIndex; document.form.SellingPrice =
price [i]; < / script>
< select name =" Description"的onUpdate = QUOT; showPrice()"> < ;? echo $ select; ?>
< / select> < input type =" text"名称= QUOT; SellingPrice" value ="">
this is the the code, now here is the final result.... I get one combo box
and
one tex box come up, but they are empty...
DAMN!!!
Any ideas on what Im doing wrong please..
Thanks Again
<?php require_once(''..\library_database\Connections\onli nequote.php''); ?>
<?
function select_cases_price ()
{
$qy = "SELECT SellingPrice, Description FROM cases";
$rs = mysql_query ($qy) or die (mysql_error ());
while (mysql_fetch_array ($rs))
{ $select .= "<option value=''{$r[0]}''>{$r[0]}</option>\n";
$prices[] = $r{1};
}
return array ($select, $prices);
}
?>
On your web page, call the function.
<? list ($select, $prices) = select_cases_price (); ?> And a bit of JS:
<script>
function showPrice() {
array prices (<? echo $prices ?>);
var i = document.form.item.selectedIndex; document.form.SellingPrice =
prices[i]; </script>
<select name="Description" onUpdate="showPrice()"> <? echo $select; ?>
</select> <input type="text" name="SellingPrice" value="">
推荐答案
qy =" SELECT SellingPrice,Description FROM cases" ;;
qy = "SELECT SellingPrice, Description FROM cases";
rs = mysql_query(
rs = mysql_query (
qy)或死(mysql_error());
while(mysql_fetch_array(
qy) or die (mysql_error ());
while (mysql_fetch_array (
这篇关于组合框/文本框php mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!