在做一個添加分類的功能。
添加成功後,返回介面。
看到添加這個分類這個行為確實成功了(多出一個分類條),但是本應該是顯示新增分類名的位置顯示的卻是數字0...
回複討論(解決方案)
無代碼,無真相
初學階段,現在是用smarty寫的。附代碼
一.修改分類的php代碼
header("Content-Type:text/html;charset=utf-8");
include_once '../smarty/Smarty.class.php';
include_once '../dbio/NewsTypes.php';
$smarty=new Smarty();
$act=$_GET['act'];
$typeId=$_GET['typeId'];
$typeName=$_POST['typeName'];
$newsTypes=NewsTypes::getNewsTypes();
if ($act=="delete") {
$result=NewsTypes::delNewsType($typeId);
header("location:success.php?act=deltype&rst={$result}");
}else if($act=="update"){
$result=NewsTypes::updateNewsType($typeId,$typeName);
header("location:success.php?act=modtype&rst={$result}");
}
$smarty->assign("newsTypes",$newsTypes);
$smarty->assign("typeId",$typeId);
$smarty->assign("typeName",$typeName);
$smarty->display('modtype.html');
。。。。發錯了。。。。。
。。。實在不好意思 重發
一.添加分類的PHP代碼
header("Content-Type:text/html;charset=utf-8");
include_once '../smarty/Smarty.class.php';
include_once '../dbio/NewsTypes.php';
$smarty= new Smarty();
$typeName=$_POST['typeName'];
var_dump($typeName);
if ($typeName!=null) {
$result=NewsTypes::addNewsTypes($typeName);
header("location:success.php?act=addtype&rst={$result}");
}
$smarty->display("addtype.html");