我有从 mysql 填充的 texbox 和下拉列表。我想使用下拉列表更改文本框值。我的文本框值也从 mysql 填充。这是我的代码。提前致谢。
<?php
if(!isset($_SESSION)){
session_start();
}
$dingo=$_SESSION['dingo'];
$query11="Select ISO3,Notify,Dingoid from rahul_tbl_users where Dingoid=$dingo";
$query123=mysql_query($query11);
$query1234=mysql_fetch_array($query123);
$fetch=mysql_query(" SELECT tdd.Dingoid,
tc.Dingoid,
tc.A_End,
tbidd.OpportunityNumber,
tbidd.Status,
tbidd.Country,
tbidd.OpportunityName,
tbidd.Allocatedto,
tbidd.Email,
tbidd.Customer,
tbidd.Country,
tbidd.ContactName,
tc.Usertype,
tbidd.G1_OPPID
FROM scott123.rahul_tbl_users tdd
INNER JOIN scott123.rahul_user_opps tc
ON tdd.Dingoid=tc.Dingoid
INNER JOIN scott123.rahul_tbl_opportunities tbidd
ON tc.A_End=tbidd.OpportunityNumber
WHERE tc.Dingoid =$dingo"
);
$fetch_result=mysql_fetch_array($fetch);
?>
<?php
$SQLString="SELECT distinct(G1_OPPID),ContactName from rahul_tbl_opportunities
WHERE G1_OPPID IS NOT NULL and ContactName!='' ";
$result1 = mysql_query($SQLString);
?>
<form id="form1" method="post" action=""> <br>
<table class="gridtable">
<tr>
<th>
<strong>Users Permission </strong></th></tr>
<br>
<tr>
<td>
<?php
//filename: populate.php
if (!empty($_POST)) {
switch ($_POST['select1']) {
case 1:
$value = $rows1['ContactName'];
break;
default:
$value = '';
}
}
?>
<select name="select1" onchange="onchange="this.form.submit();">
<?php
while($rows1=mysql_fetch_array($result1)){
?>
<option id='user_name' value="<? echo $rows1['ContactName']; ?>"><? echo $rows1['ContactName']; ?></option>
<?php
}
?>
<input type="text" name="test" value="<?php echo $value;?>" />
</select>
<input type="submit" name="submit_name11" value="Add Permission"/>
<input type="submit" name="submit_name12" value="Edit Permission"/>
</td>
</tr>
</table>
</form>