添加数据,显示添加行为成功,但是输入的数据显示是0

原创
2016-06-23 13:01:59 699浏览

在做一个添加分类的功能。
添加成功后,返回界面。
看到添加这个分类这个行为确实成功了(多出一个分类条),但是本应该是显示新增分类名的位置显示的却是数字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");

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。