Welcome Guest, Not a member yet? Register   Sign In
Problem str_replace set_radio form validation


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

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.




Theme © iAndrew 2016 - Forum software by © MyBB