gpt4 book ai didi

forms - 如何在 codeigniter 表单中同时具有默认值和设置值?

转载 作者:行者123 更新时间:2023-12-04 14:03:54 25 4
gpt4 key购买 nike

我在 codeigniter 中有一个表单,并希望为我的输入以及 set_value() 设置一个默认值。

这是我的输入:

echo form_input('job_position',set_value('job_position'));

我有一个设置值并且可以工作,但是如何添加默认值“12”?

最佳答案

如果值为空,您可以设置默认值。

来自 codeigniter site :

set_value()

Permits you to set the value of an input form or textarea. You must supply the field name via the first parameter of the function. The second (optional) parameter allows you to set a default value for the form. Example:


<input type="text" name="job_position" value="<?php echo set_value('job_position', '12'); ?>" size="50" />

The above form will show "12" when loaded for the first time.

关于forms - 如何在 codeigniter 表单中同时具有默认值和设置值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10946694/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com