简体   繁体   English

使用HTML表单将Smarty变量传递给php文件。

[英]Passing a Smarty variable to a php file using HTML form.

I have this form inside a Smarty template file : 我在Smarty模板文件中有此表单:

<form method="post" action="manswer.php">
        <table border="0" cellpadding="5" cellspacing="0" >
            <tr>
                <td style = "vertical-align:top;">Answer:</td>
                <td><textarea rows="8" cols="50" name='answer_text' ></textarea></td>
            <tr>
                <td><br/></td>
                <td><input  id = 'answerbutton' type='submit'  value='Cevapla!' /></td>
            </tr>
            </tr>
        </table>
</form>

I also have {$q_id} variable inside that template file. 在该模板文件中也有{$ q_id}变量。 How can I pass this variable to manswer.php with that HTML form? 如何使用该HTML表单将此变量传递给manswer.php? Thanks. 谢谢。

使用隐藏字段。

<input type="hidden" value="{$q_id}" name="something" />

Using a hidden input field. 使用隐藏的输入字段。

<input type="hidden" value="<?php echo $q_id;?>" name="something" />

Then to retrieve it using CodeIgniter 然后使用CodeIgniter进行检索

...
$something = $this->input->post('something');
...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM