|
|
|
รบกวนเกี่ยวกับตัวที่ส่งค่าจาก onchange="document.getElementById('result') ทีค่ะ |
|
|
|
|
|
|
|
จากตัวอย่าง ไม่มีค่าไรขึ้นมาเลยค่ะ ไม่รู้ติดปัญหาไร ช่วยทีนะคะ
Code (PHP)
<?php
$host="localhost";
$username = "root";
$password = "123456";
$db="mydb";
$connect=mysql_connect($host,$username,$password) or die ("Cannot Connect to MySQL");
mysql_select_db($db) or die ("Cannot connect to Database");
mysql_query("set NAMES tis620");
$sql2="SELECT * FROM product INNER JOIN price ON product.productid = price.productid";
$result2 = mysql_query($sql2);
$Num_Rows2 = mysql_num_rows($result2);
//echo "<select name=productid size=1 class=input id=productid onchange=document.getElementById('result').innerHTML = 'ราคา' + this.options[this.selectedIndex].value;>";
?>
<select name=bytype size=1 class="input" id=bytype onchange="document.getElementById('result').innerHTML = '' + this.options[this.selectedIndex].value;">
<?
echo "<option value=''>เลือกสินค้า</option>";
While($row2= mysql_fetch_array($result2)){
$productprice = $row2["price"];
$productname = $row2["productname"];
?>
<option value="<? echo $productprice; ?>"><? echo $productname; ?> </option>
<?
}
echo "</select>";
?>
<input id="result" name="result" type="text" />
|
|
|
|
|
Date :
2011-07-20 11:29:53 |
By :
thaimaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|