簡體   English   中英

使用HTML表單將Smarty變量傳遞給php文件。

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

我在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>

在該模板文件中也有{$ q_id}變量。 如何使用該HTML表單將此變量傳遞給manswer.php? 謝謝。

使用隱藏字段。

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

使用隱藏的輸入字段。

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

然后使用CodeIgniter進行檢索

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM