Jump to content

multiple foreach help


dsp77

Recommended Posts

Hello, i'm trying to create a table with questions and input answers. The problem i'm facing is how can i generate dynamically the input name and value unique because some questions have other dates or criteria. I was thinking of adding in the db a field with the type of the question or a new table with question types then using foreach and if to generate, i don't have much time to test and i'm asking for your help/advise. Hope i was clear enough . PS: I'm using PEAR SIGMA as template.

<table class="tablesorter" border="0" cellspacing="1" cellpadding="0">
        <thead>
          <tr>
            <th align="center"><span> </span></th>
            <th align="center"><span>2005 - 2006</span></th>
            <th align="center"><span>2006 - 2007</span></th>
            <th align="center"><span>2007 - 2008</span></th>
            <th align="center"><span>2008 - 2009</span></th>
            <th align="center"><span>2009 - 2010</span></th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="center"><span>preparator</span></td>
            <td align="center"><input type="text" name="pi11_preparator_0506" value="{pi11_preparator_0506}" /></td>
            <td align="center"><input type="text" name="pi11_preparator_0607" value="{pi11_preparator_0607}" /></td>
            <td align="center"><input type="text" name="pi11_preparator_0708" value="{pi11_preparator_0708}" /></td>
            <td align="center"><input type="text" name="pi11_preparator_0809" value="{pi11_preparator_0809}" /></td>
            <td align="center"><input type="text" name="pi11_preparator_0910" value="{pi11_preparator_0910}" /></td>
          </tr>
          <tr>
            <td align="center"><span>asistent</span></td>
            <td align="center"><input type="text" name="pi11_asistent_0506" value="{pi11_asistent_0506}" /></td>
            <td align="center"><input type="text" name="pi11_asistent_0607" value="{pi11_asistent_0607}" /></td>
            <td align="center"><input type="text" name="pi11_asistent_0708" value="{pi11_asistent_0708}" /></td>
            <td align="center"><input type="text" name="pi11_asistent_0809" value="{pi11_asistent_0809}" /></td>
            <td align="center"><input type="text" name="pi11_asistent_0910" value="{pi11_asistent_0910}" /></td>
          </tr>
          <tr>
            <td align="center"><span>lector/șef de lucrări</span></td>
            <td align="center"><input type="text" name="pi11_lector_0506" value="{pi11_lector_0506}" /></td>
            <td align="center"><input type="text" name="pi11_lector_0607" value="{pi11_lector_0607}" /></td>
            <td align="center"><input type="text" name="pi11_lector_0708" value="{pi11_lector_0708}" /></td>
            <td align="center"><input type="text" name="pi11_lector_0809" value="{pi11_lector_0809}" /></td>
            <td align="center"><input type="text" name="pi11_lector_0910" value="{pi11_lector_0910}" /></td>
          </tr>
          <tr>
            <td align="center"><span>conferențiar</span></td>
            <td align="center"><input type="text" name="pi11_conferentiar_0506" value="{pi11_conferentiar_0506}" /></td>
            <td align="center"><input type="text" name="pi11_conferentiar_0607" value="{pi11_conferentiar_0607}" /></td>
            <td align="center"><input type="text" name="pi11_conferentiar_0708" value="{pi11_conferentiar_0708}" /></td>
            <td align="center"><input type="text" name="pi11_conferentiar_0809" value="{pi11_conferentiar_0809}" /></td>
            <td align="center"><input type="text" name="pi11_conferentiar_0910" value="{pi11_conferentiar_0910}" /></td>
          </tr>
          <tr>
            <td align="center"><span>profesor</span></td>
            <td align="center"><input type="text" name="pi11_profesor_0506" value="{pi11_profesor_0506}" /></td>
            <td align="center"><input type="text" name="pi11_profesor_0607" value="{pi11_profesor_0607}" /></td>
            <td align="center"><input type="text" name="pi11_profesor_0708" value="{pi11_profesor_0708}" /></td>
            <td align="center"><input type="text" name="pi11_profesor_0909" value="{pi11_profesor_0909}" /></td>
            <td align="center"><input type="text" name="pi11_profesor_0910" value="{pi11_profesor_0910}" /></td>
          </tr>
        </tbody>
      </table>

Link to comment
https://forums.phpfreaks.com/topic/232632-multiple-foreach-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.