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

我听闻始终一个人 2016-06-10 06:44:45
在做一个添加分类的功能。
添加成功后,返回界面。
看到添加这个分类这个行为确实成功了(多出一个分类条),但是本应该是显示新增分类名的位置显示的却是数字0...
...全文
59 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
。。。实在不好意思 重发 一.添加分类的PHP代码 <?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");
  • 打赏
  • 举报
回复
。。。。发错了。。。。。
  • 打赏
  • 举报
回复
初学阶段,现在是用smarty写的。附代码


一.修改分类的php代码


<?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');
xuzuning 2016-06-10
  • 打赏
  • 举报
回复
无代码,无真相

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧