我的页面上有一个下拉列表,同一页面上有一个 html 表,并且列的值来自数据库表。下拉列表有 3 个选项。即联邦、州和本地我希望当我选择任何选项时,我的页面在同一页面上重新加载并更改表中的列值,其值在数据库中为联邦值、州值和本地值设置。
<select name="election" id="text" >
<option value="federal"> Federal </option>
<option value="state"> State </option>
<option value="local"> Local </option>
</select>
this is dropdown list code
<form name="form1">
<table width="90%" border="0" cellpadding="1" cellspacing="1" bgcolor="#c0c0c0">
<tr>
<td width="9%" align="center" bgcolor="#FFFFFF" class="head01"><input type="checkbox" value="1" onClick="$('input[name*=\'selected\']').attr('checked', this.checked);" id="check_all" name="data[Farm][check_all]" >
</td>
<td width="7%" align="center" bgcolor="#FFFFFF" class="head01">Sr. No. </td>
<td width="25%" align="center" bgcolor="#FFFFFF" class="head01">Leader name</td>
<td width="13%" align="center" bgcolor="#FFFFFF" class="head01">Facebook Like</td>
<td width="11%" align="center" bgcolor="#FFFFFF" class="head01">Twitter Like</td>
<td width="10%" align="center" bgcolor="#FFFFFF" class="head01" id="value"> Value</td>
<td width="12%" align="center" bgcolor="#FFFFFF" class="head01">View Profile</td>
<td width="15%" align="center" bgcolor="#FFFFFF" class="head01">Select PM</td>
</tr>
<?php
$election=$_REQUEST['election'];
$result = mysql_query("SELECT * FROM leader_info");
$i=1;
while($row = mysql_fetch_assoc($result))
{
?>
<tr>
<td bgcolor="#FFFFFF" align="center"><input type="hidden" value="0" id="chkids" name="chkid[0]">
<input type="checkbox" id="ChkIds" value="<?php echo $row['leader_id']; ?>" name="selected[]" onChange="myFunction(this)" class="<?php echo $row['state_point'];?>">
</td>
<td bgcolor="#FFFFFF" align="center"><span class="subdetails"><?php echo $i++; ?></span></td>
<td bgcolor="#FFFFFF" align="left"><span class="subdetails"><?php echo $row['leader_name']; ?></span></td>
<td bgcolor="#FFFFFF" align="left"><?php echo $row['facebook']; ?></td>
<td bgcolor="#FFFFFF" align="left"><?php echo $row['twitter']; ?></td>
<td bgcolor="#FFFFFF" align="left" class="<?php echo $row['state_point'];?>" ><?php echo $row['state_point'];?>
</td>
<td align="center" bgcolor="#FFFFFF"><a href='#'><img style='vertical-align:bottom;' src='images/view profile.png' width='10' height='10' border='0'></td>
<td align="center" bgcolor="#FFFFFF"><input type="radio" name="pm" value="pm"></td>
</tr>
<?php } ?>
<tr>
<td align="center" bgcolor="#FFFFFF">Remaining Budget : </td>
<td align="center" bgcolor="#FFFFFF"><span id="total" class="0">1000</span></td>
<td>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><input type="submit" name="add" value="Add Team"> </td>
<td align="center" bgcolor="#FFFFFF"><input type="reset" value="Clear Team" onClick="javascript:changeTextToBlack();"></td>
</tr>
</table>
</form>
这是我的表格代码,我想在其中进行更改,在选择下拉列表时自动将值更改为本地,联邦代替州,其他字段保持不变,仅更改值列