应该是“请问php如何得到smarty模版中表单提交的变量“
一着急打错了

解决方案 »

  1.   

    必须先
    $smarty->assign("name","value");才可以得到。
      

  2.   

    ====index.tpl====<{* Smarty *}>
    <{php}>session_start();<{/php}>
    <html>
    <head></head>
    <body>
    <form action=test1.php method=post>
    <{html_select_date start_year='2002' end_year='2004'  month_format='%d' field_order='YMD'}><input type=submit>
    </form></body>
    </html>====index.php====
    <?php
    session_start();//这个我不知道需不需要
    define('SMARTY_DIR','/usr/local/www/Smarty/libs/');
    require(SMARTY_DIR.'Smarty.class.php');
    $smarty = new Smarty;$smarty->template_dir = '/usr/local/www/smartytest/templates/';
    $smarty->compile_dir = '/usr/local/www/smartytest/templates_c/';
    $smarty->config_dir = '/usr/local/www/smartytest/configs/';
    $smarty->cache_dir = '/usr/local/www/smartytest/cache/';
    $smarty->left_delimiter = '<{';
    $smarty->right_delimiter = '}>';$smarty->debugging = true;$smarty->assign('name','snake');
    $smarty->assign('da',$_POST['Date_year']);
    var_dump($da);
    $smarty->display('index.tpl');?>这样吗?请教...
      

  3.   

    不明白你的意思啊
    其实无论是否用smarty,php从表单取值都是一样的啊
    比如你表单中有<input type=text name=text1 id=text1 value="abc">
    post之后,php中使用$_POST['text1']就能够得到对应的值了啊
    smarty并非对php技术做了任何的修改,对php与client的交互没有任何影响的。
      

  4.   

    到了客户端以后都是页面了,不管是怎么生成的,模板输出的也好,php输出的也好,静态页面也好,反正都一样。