<?php
$sql = "select * from letter where societyn='" . $_SESSION['socityname'] ."' ";
$result = mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($result)){
?>
<?php
$id = $row['id'];
$dater = $row['date'];
$flatnonam = $row['flatno_name'];
$addr = $row['adress'];
$subject = $row['subject'];
$body = $row['body'];
$soci = $row['societyn'];
$refnum = $row['refno'];
$letterh = $row['letterh'];
// split "dd-mm-yyyy" into an array of three elements
$ddate = explode("-", $dater);
// retrieve the values
$month = $ddate[1]; // mm
$day = $ddate[2]; // dd
$year = $ddate[0]; // yyyy
{
?>
<tr>
<td><?php echo $day.'/'.$month.'/'.$year; ?></td>
<td><?php echo $flatnonam; ?></td>
<td><?php echo $letterh; ?></td>
<td><?php echo $addr; ?></td>
<td><?php echo $subject; ?></td>
<td><?php echo $soci; ?></td>
<td><?php echo '#'.$refnum; ?></td>
<td>
<select name="menu1" id="menu1">
<option value="" selected>Pick a Website</option>
<option value="letter/letter_print.php?id=<?php echo $row['id']; ?>">Without Letter Head</option>
<option value="letter/letter_print_nohead.php?id=<?php echo $row['id']; ?>">Letter Head</option>
</select>
</td></tr>
<?php }?>
<?php
echo "<br>";
$i++;
}
?>
<!--This is java script-->
<script type="text/javascript">
var urlmenu = document.getElementById('menu1');
urlmenu.onchange = function() {
window.open(this.options[ this.selectedIndex ].value, '_blank','width=595,height=842,directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
};
</script>
這是我的代碼.only第一個選項工作其他不工作。 請幫我解決麻煩。從2天起。或者給出另一個解 在一個ID如何使用所有選項。我試圖從2天不工作。下拉選擇去url不工作在while循環php
這是我的查詢screenshoot:HTTP://我.stack.imgur.com/hk6ad.jpg –
ID是唯一的,JS與第一個一起工作,如果頁面中有更多相同的ID。 – panther
不能準確得到你想要做的?你正在重定向的網址是 –