<?php
session_start();
require_once '../inc/const.php';
$id =getvar('id');$name  =getvar('name');
$addr  =getvar('addr');
$httpurl =getvar('httpurl');
$tel =getvar('tel');
$mobile =getvar('mobile');
$fax  =getvar('fax');
$email  =getvar('email');
$qq  =getvar('qq');
$area  =getvar('area');
$industry =getvar('industry'); 
$rank =getvar("rank");$temp_fwnr = "";
$fwnr = $_POST['fwnr'];
for($i=0;$i<count($fwnr);$i++){
$service_start = "service_start".$fwnr[$i];
$service_end = "service_end".$fwnr[$i];
$service_content = "service_content".$fwnr[$i];
$temp_services = $fwnr[$i].",".$_POST[$service_start].",".$_POST[$service_end].",".$_POST[$service_content];
$temp_fwnr = empty($temp_fwnr) ? $temp_services : $temp_fwnr."|".$temp_services;

}
foreach($_POST as $na=>$v) {
  @$$na = iconv('gb2312', 'utf-8', $v);
}
if($act=='add'){
$record = array(
'name' =>$name,
'addr' =>$addr,
'httpurl' =>$httpurl,
'tel' =>$tel,
'mobile' =>$mobile,
'fax' =>$fax,
'email' =>$email,
'qq' =>$qq,
'area' =>$area,
'industry' =>$industry,
    'services' =>$temp_fwnr,
'rank' =>$rank,
'dateline' =>date("y-m-d H-i-s")
);
$id = $db->insert($GLOBALS[databasePrefix].'customer',$record);
echo '这个页面是由form表单提交过来的页面,请问如何在此 输出当前(本次)提交的信息?非常的感谢你的指教!!谢谢!!!';
}
?>

解决方案 »

  1.   

    你form提交是怎么提交过来的就怎么取,应该在$_REQUEST会有你要的信息,
    把它打出来看看就知道了。
      

  2.   

    表单代码如下:
    <script>
    function checksubmit(){
    if (document.myform.name.value=="") {
    window.alert("姓名不能为空!!");
    document.myform.name.focus();
     return (false);
    }
    return true;
    }
    </script>
    <form name="myform" method="post" action="tomer.php?act=add" onSubmit="return checksubmit();">
    <input name="name" type="text" id="name" size="14" onblur="this.style.margin='1px';this.style.border='1px solid #BBB';" style="BORDER-RIGHT: #bbb 1px solid; BORDER-TOP: #bbb 1px solid; MARGIN: 1px; BORDER-LEFT: #bbb 1px solid; BORDER-BOTTOM: #bbb 1px solid" onfocus="this.style.margin='0';this.style.border='2px solid #666';"/>
      &nbsp;&nbsp;&nbsp;
    <input type="hidden" name="area" id="area" value="1"><input name="tel" type="text" id="tel" size="14" onblur="this.style.margin='1px';this.style.border='1px solid #BBB';" style="BORDER-RIGHT: #bbb 1px solid; BORDER-TOP: #bbb 1px solid; MARGIN: 1px; BORDER-LEFT: #bbb 1px solid; BORDER-BOTTOM: #bbb 1px solid" onfocus="this.style.margin='0';this.style.border='2px solid #666';"/>
      &nbsp;&nbsp;&nbsp;
    <input type="hidden" name="industry" id="industry" value="1">
    <input name="qq" type="text" id="qq" size="30" onblur="this.style.margin='1px';this.style.border='1px solid #BBB';" style="BORDER-RIGHT: #bbb 1px solid; BORDER-TOP: #bbb 1px solid; MARGIN: 1px; BORDER-LEFT: #bbb 1px solid; BORDER-BOTTOM: #bbb 1px solid" onfocus="this.style.margin='0';this.style.border='2px solid #666';"/>
    <select name="addr" id="addr">
    <option>请 选 择</option>
    <option value="北京" >北京</option>
    <option value="上海" >上海</option>
    </select>分类<select name="fwnr[]" id="servicefwnr">
    <option value="1" >五金</option>
    <option value="2" >家电</option>
    </select><input type="hidden" name="fax" value="小伍">
    <input type="submit" name="button" id="button" value="确定" onClick="this.form.fax.value=form1.myform.value"/> <input type="button" name="back" id="back" value="返回" onclick="javascript:window.history.go(-1);" />
    </form>
      

  3.   

    你有 分类<select name="fwnr[]" id="servicefwnr">
    上传后 $_POST['fwnr'] 将是一个数组
    所以在执行 $$na = iconv('gb2312', 'utf-8', $v);
    时会报错 iconv() expects parameter 3 to be string, array given in 
    虽然你屏蔽了错误信息,但这个错误将导致变量 $fwnr 无值,从而引发后续的错误你应该删除
    foreach($_POST as $na=>$v) {
      @$$na = iconv('gb2312', 'utf-8', $v);程序开始处写成这样
    <?php
    session_start();
    require_once '../inc/const.php';
    $id =getvar('id');$_POST = eval('return ' . iconv('gb2312', 'utf-8', var_export($_POST, true)) . ';');$name         =getvar('name');
    ....另外你应该检查 getvar 函数的定义,看他是从何处取值的,如果是 $_REQUEST
    那么还需加上
    $_REQUEST = eval('return ' . iconv('gb2312', 'utf-8', var_export($_REQUEST, true)) . ';');
      

  4.   

    可以借助我的列表页,找到答案吗?
    以下是我列表页的代码
    <?php
    session_start();
    require_once '../inc/const.php';$page  = $_GET ['page'] ? $_GET ['page'] : 1;
    $page_size  = 30;
    $sqlstr=get_sql("select * from {pre}customer order by rank asc,id desc");
    $s_list = $db->selectLimit ( $sqlstr, $page_size, ($page - 1) * $page_size );
    $total_nums = $db->getRowsNum ( $sqlstr );
    ?>//分类
    <?php
    foreach ($s_list as $list){
    $temp_services = $list['services'];
    $str_array = split("\|",$temp_services);
    foreach($str_array as $str_list){
    $str_list_array = split(",",$str_list);
    $temp_qq = empty($list['qq']) ? "-" : "<a href=\"http://wpa.qq.com/msgrd?V=1&amp;Uin=".$list['qq']."&amp;Site=金华仁爱医院&amp;Menu=yes\" target=\"blank\"><img alt=\"在线联系\" src=\"http://wpa.qq.com/pa?p=1:".$list['qq'].":4\" border=\"0\" />".$list['qq']."</a>";
      ?>
    //输出数据
    <?php echo $list['id'];?>
    <?php echo $list['name'];?>
    <?php echo empty($list['tel']) ? "-" : $list['tel'];?>
    <?php echo get_customer_services($list['services']);?>
    <?php echo $list['dateline']; ?>//分页
    <?php page($sqlstr,$page_size,"customer_list.php?page",$page);?>
      

  5.   

    我在这个页面下加了<?php
    $sqlstr=get_sql("select * from {pre}customer order by rank asc,id desc");
    $total_nums = $db->getRowsNum ( $sqlstr );if (isset($_POST['name'])) {
         echo "你的名字是:". $_POST['name'];
    }if (isset($_POST['id'])) {
         echo "你的编号是:". $_POST['id'];
    }
    ?>
    名字(name)正常的输出来了但编号(id)输不出来求解决方法  谢谢了
      

  6.   

    你的id怎么是$_POST过来的呢,不是应该在数据库中查出来的吗
      

  7.   

    if (var_dump($_POST['id'])){
         echo "你的预约号是:". $_POST['id'];
    }if (isset($_POST['name'])) {
         echo "你的名字是:". $_POST['name'];
    }
    }
    我这样写  输出的为什么是NULL啊?????
      

  8.   

    这个就是了啊,在文件的开头写上这句话,然后提交form就可以看到了