CodeIgniter Forums
Problem str_replace set_radio form validation - 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: Problem str_replace set_radio form validation (/showthread.php?tid=60542)



Problem str_replace set_radio form validation - El Forum - 04-18-2014

[eluser]Unknown[/eluser]
Hello,

I'm making a simple system with formfield that are coming from the database. In the database I write the html output, but without the set_value/set_radio php code. The reason why is that a simple person with no brains could place a input field in the database by admin.

Now the problem, I want that the field had the set_value, set_radio etc options in it.

What is working:

From database ($formhtml):
<div class="veld"><span>Voornaam</span>&lt;input type="text" name="voornaam" class="form100" maxlength="20" value=""&gt;&lt;/div>

and than do this:
$formhtml = str_replace('value=""','value="'.set_value(''.$input_naam.'').'"',''.$formhtml.'');


That is working fine because it's one field, en the value has no basis value.


But I can't get it good if the code is this:
<div class="veldgeslacht"><span>Geslacht</span>&lt;input type="radio" name="geslacht" value="M"&gt;Man&nbsp;&nbsp;&lt;input type="radio" name="geslacht" value="V"&gt;Vrouw
</div>


As you can see there are 2 radiobuttons in this, and the radiobuttons has an value. How could I do it that on that peace of code also the set_radio is working properly? That the code in the database is as above, but in the controller it will replace with the code including the set_radio information.

Thanks for the help.

Greetings,

Wesley


Problem str_replace set_radio form validation - El Forum - 04-25-2014

[eluser]Unknown[/eluser]
Someone?