PHP and MySQL - Placing textboxes in div

0

I am trying a reverse engineering with PHP, Javascript and MySQL query. I am creating a form for editing events registered in a database table.

In one of the fields, called the Presence List, here's how it brings the value of the presence list field inside the numPart

:

<div class="BoxForm1" id="nomeParticipante">
                <br>
                <div id="numPart">
                    <?php foreach ($data['evento'] as $evento){ echo $evento['listapresenca']; } ?>
                </div>
                <input type="hidden" name="part_text" id="part_text" value="" />
            </div>

In the form that inserts a new data, the presence list is composed of one or more textbox, depending on how many participants the event will have. Usually the field is registered as follows:

Name 1
Name 2
Name 3
... Name 10

What I wanted was a way to turn the presence list text (the text of the div ) into several textboxes, each going from the name to the new line signal

How can I do this?

    
asked by anonymous 20.06.2016 / 18:03

1 answer

0

I discovered the solution. I just use the explode:

<div id="numPart">
    <?php foreach ($data['evento'] as $evento){
        $participantes = explode("<br>",$evento['listapresenca']);
        for($numero=0;$numero<(count($participantes)-1);$numero++){
            echo "<div class='inputMGM'><input name='part".($numero+1)."' id='part".($numero+1)."' value='".$participantes[$numero]."' class='validate[required]'></input></div><br>";
        }
</div>
    
21.06.2016 / 15:10