怎样把注册中的生日显示在数据库中
$birthday=form.birthday.values;
我把年月日放在一个表单里面但是注册后,数据库里没有生日没有显示只是0000-00-00 00:00:00 

解决方案 »

  1.   

    提交时print_r($_POST);看看有些什么。
      

  2.   

    $lt_user=trim($_POST[lt_user]);
    $pwd=md5($_POST[pwd]);
    $repwd=md5($_POST[repwd]);
    $true_pwd=$_POST[pwd];
    $email=trim($_POST[email]);
    $address=trim($_POST[address]);
    $birthday=trim($_POST[birthday]);
    $sex=trim($_POST[sex]);
    $lt_date=date("Y-m-d h:i:s");
    $lt_picture=$_POST[lt_picture];
    $lt_pass_problem=trim($_POST[lt_pass_problem]);
    $lt_pass_result=$_POST[lt_pass_result];
    $lt_type=1;
    $lt_grade=10;
    $query=mysql_query("insert into lt_user(lt_user,pwd,repwd,true_pwd,email,address,birthday,sex,lt_type,lt_date,lt_picture,lt_pass_problem,lt_pass_result) values('$lt_user','$pwd','$repwd','$true_pwd','$email','$address','$birthday','$sex','$lt_type','$lt_date','$lt_picture','$lt_pass_problem','$lt_pass_result')",$conn);
      

  3.   

    $lt_grade=10;后面加print_r($_POST);
    exit();看有什么数据。
      

  4.   

    数据表中不仅保存加密密码,加密确认密码 ,还有密码明文这个有必要么?数据库中显示0000-00-00 00:00:00说明是时间格式错误,导致插入这样的时间。打印你的sql语句看是什么结果。
    $birthday = trim($_POST[birthday]);
    echo $birthday;看下这个格式可能错了
    echo $sql;
    关键是字段有没有值,值是否正确。
      

  5.   

    注册之后 显示Array ( [lt_user] => jj [pwd] => 000 [repwd] => 000 [email] => [email protected] [lt_picture] => images/face/6.gif [sex] => 男 [birthday] => 25 [address] => 云南 [lt_pass_problem] => 我最喜欢的运动员是谁? [lt_pass_result] => ym [yzm] => 8702 [num] => 8702 [Submit] => 立即提交注册 ) 
      

  6.   


    看到值了么?$birthday = 25;这个数值插入datetime类型的字段的话,当然会是0000-00-00,还是你的birthday的地方设置错了。
      

  7.   


    年月日可以直接用js。网上搜索calerder.js 日期控件很多的。
      

  8.   

    对吧。post 数据都不对。[birthday] => 2525怎么行呢。你要插入当前时间的话。sql '$birthday'  直接  改在 now()
      

  9.   

    用这个插件吧。。让他们先日期My97 DatePicker 4.72 Release
    License: http://www.my97.net/dp/license.asp
    百度都用的