0

Pic

I have a table with rows from a database, to that table I do a foreach like you normally would to get the rows. The picture is above.

Well my project needs to have action buttons for the rows on the table so I created check boxes (all went smooth). Now my problem is that when I hit the submit button when my form is fully filled out for some reason the button does nothing. I have used the form helper in other pages of my project with no problem. Now I am getting my first problem.

This is my view for the table:

<table id='waiting' class='display'>
    <thead>
        <tr>
            <th>ID</th>                       
            <th>A Number</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Reason for visit</th>
            <th>Comments</th>
            <th>Aid Year</th>
            <th>Staff Comments</th>
            <th>Staff Member</th>
            <th>Options</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($waiting as $row) { ?>                 
        <tr>
            <td><?php echo htmlspecialchars($row['id'], ENT_QUOTES, 'UTF-8'); ?></td>               
            <td><?php echo htmlspecialchars($this->encrypt->decode($row['anum']), ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlspecialchars($row['first'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlspecialchars($row['last'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlspecialchars($row['reason'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlspecialchars($row['studentcomments'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlspecialchars($row['aidyear'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td><?php echo htmlspecialchars($row['counselorcomments'], ENT_QUOTES, 'UTF-8'); ?></td>
            <td>
                <?php echo form_open('studentqueue_controller/counselorscreen'); ?>
                <?php echo form_dropdown('namedrop', $names) ?></td>
            <td>
                <input type="checkbox" name="options" value="start" <?php echo form_checkbox('options','start') ?>Start</input>
                <input type="checkbox" name="options" value="stop" <?php echo form_checkbox('options','stop') ?>Incactive</input>
            </td>
        </tr>
        <?php } ; ?>
        <?php echo form_submit('submit', 'Start Action'); ?>
        <?php echo form_close(); ?>

I start the form open in the loop as I need all the rows in table to have a action to them (start and terminate)

What am I missing here?

4

2 に答える 2

0
 <h3>Students Waiting</h3>
                <table id='waiting' class='display'>
                    <thead>
                        <tr>
                            <th>ID</th>                       
                            <th>A Number</th>
                            <th>First Name</th>
                            <th>Last Name</th>
                            <th>Reason for visit</th>
                            <th>Comments</th>
                            <th>Aid Year</th>
                            <th>Staff Comments</th>
                            <th>Staff Member</th>
                            <th>Options</th>
                        </tr>
                    </thead>
                    <tbody>

                        <?php
                        foreach ($waiting as $row) 
                        { 
                            ?>                
                        <tr>
                            <td><?php echo htmlspecialchars($row['id'], ENT_QUOTES, 'UTF-8'); ?></td>               
                            <td><?php echo anchor('studentqueue_controller/history/'.urlencode($row['anum']). '', $row['anum'], 'target="_blank"'); ?></td>
                            <td><?php echo htmlspecialchars($row['first'], ENT_QUOTES, 'UTF-8'); ?></td>
                            <td><?php echo htmlspecialchars($row['last'], ENT_QUOTES, 'UTF-8'); ?></td>
                            <td><?php echo htmlspecialchars($row['reason'], ENT_QUOTES, 'UTF-8'); ?></td>
                            <td><?php echo htmlspecialchars($row['studentcomments'], ENT_QUOTES, 'UTF-8'); ?></td>
                            <td><?php echo htmlspecialchars($row['aidyear'], ENT_QUOTES, 'UTF-8'); ?></td>
                            <td><?php echo htmlspecialchars($row['counselorcomments'], ENT_QUOTES, 'UTF-8'); ?></td>
                            <td>
                                <?php echo form_open('studentqueue_controller/counselorscreen'); ?>
                                <?php echo form_dropdown('namedrop', $names) ?></td>
                            <td>
                                <input type="checkbox" name="options" value="start" <?php echo form_checkbox('options','start') ?>Start</input>
                                <br />
                                <input type="checkbox" name="options" value="stop" <?php echo form_checkbox('options','stop') ?>Delete</input>
                                <?php echo form_submit('submit', 'Start Action'); ?>                        
                                <?php echo form_close(); ?>
                            </td>
                        </tr>

                        <?php
                         } ?>
                    </tbody>    
                </table>

form_openとformcloseの両方をforeachに入れて、それでうまくいきました。

于 2013-02-23T17:03:41.070 に答える
0

フォームを 2 回開いているため、2 回目より前の内容はすべて無視されます。次の行を削除します。

 <?php echo form_open('studentqueue_controller/counselorscreen'); ?>

ネームドロップの直前からで大丈夫なはずです。ペーストビンを見てください。51 行目と 83 行目は両方とも同じフォームを開いています。

于 2013-02-23T16:06:01.600 に答える