[問題] 拜託幫新手看一下程式
需求是如果 $val['book_id']==0 就要開啟 addnew.php
else 就要開啟 modify.php
我資料庫裡的book_id 明明兩筆book_id 是零 還有一筆是五(預計能開出modify.php)
卻三筆都給我開出modify.php
我用print_r(test_bookid().$var['book_id']); 把參數印出來檢查 明明順序是我要的
005
若依此情況來看 前兩筆筆應該是要開addnew.php 可是他開出來的三筆確都是
modify.php
怎麼會這樣阿 這個程式是外國人寫的有用到smarty
smarty php實作的程式截取如下:
foreach($this->phonebook as $key=>$val){
$this->phonebook[$key]['url_dele'] =
$sess->url($_SERVER['PHP_SELF']."?kvrk=".uniqID("")."&pb_dele_id=".$val['id']);
$this->phonebook[$key]['url_edit'] =
$sess->url($_SERVER['PHP_SELF']."?kvrk=".uniqID("")."&pb_edit_id=".$val['id']);
$this->phonebook[$key]['id'] = $sess->$val['id'];
$this->phonebook[$key]['book_id'] =$val['book_id'];
// print_r($this->phonebook);
if($val['book_id']==0){
print_r(test_bookid.$val['book_id']);
?>
<script language="javascript">
function openNew(){
window.open("addnew.php?phone_bookId=<?
$val['id']?>","","status=yes,scrollbars=no,resizable=no,width=500,height=600")
}
</script>
<? }
else{
print_r(test_bookid.$val['book_id']);
?> <script language="javascript">
function openNew(){
window.open("modify.php?book_id=<?$val['book_id']?>","","status=yes,scrollbars=no,resizable=no,wih=500,height=600")
}
</script>
<?
}
template 檔的部份: <td align="center"><input type="button"
onClick="openNew()" value="{$lang_str.l_click_here}" /></a> </td>
最重要的原始檔部份:
<br>test_bookid0
<script language="javascript">
function openNew(){
window.open("addnew.php?phone_bookId=","","status=yes,scrollbars=no,resizable=no,width=500,height=600")
}
</script>
test_bookid0
<script language="javascript">
function openNew(){
window.open("addnew.php?phone_bookId=","","status=yes,scrollbars=no,resizable=no,width=500,height=600")
}
</script>
test_bookid5 <script language="javascript">
function openNew(){
window.open("modify.php?book_id=","","status=yes,scrollbars=no,resizable=no,wih=500,height=600")
}
</script>
<br />
拜託幫我解答一下 卡一個星期多了
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.240.197.163
推
09/17 19:38, , 1F
09/17 19:38, 1F
推
09/17 22:24, , 2F
09/17 22:24, 2F
→
09/18 05:01, , 3F
09/18 05:01, 3F
→
09/18 05:02, , 4F
09/18 05:02, 4F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章