CodeIgniter Forums
set_value() alternate value... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: set_value() alternate value... (/showthread.php?tid=28349)



set_value() alternate value... - El Forum - 03-08-2010

[eluser]evolutionxbox[/eluser]
I have a input with a set value in the value attribute but I want it to have a value in it already, then if required replace that with a user's value.

Code:
<input type="text" value="<?=set_value('text');?>" name="text" />

I was thinking of something like this:

Code:
<input type="text" value="<?=set_value('text', 'Type something here!');?>" name="text" />

The second value is the 'default' value which gets replaced by the user value when required.
Is there a way to do this without modifying the library?


set_value() alternate value... - El Forum - 03-08-2010

[eluser]Armchair Samurai[/eluser]
RTM again. Closely. Especially the part about the second parameter.


set_value() alternate value... - El Forum - 03-09-2010

[eluser]mattpointblank[/eluser]
Yep. That's exactly how it works.


set_value() alternate value... - El Forum - 03-10-2010

[eluser]evolutionxbox[/eluser]
Whoops... I missed that bit. =)