1

How to pass values from view to controller onclick... I need to save every row into the database

<table border="1" cellpadding="4" cellspacing="0">
    <tr>
        <td>from</td>
        <td>to</td>
        <td>title</td>
        <td>openletter</td>
        <td>open_id</td>
    </tr>

    <?php foreach ($r->result() as $row): ?>

        <tr>
            <td><?php echo $row->from; ?></td>
            <td><?php echo $row->to; ?></td>
            <td><?php echo $row->title; ?></td>
            <td><?php echo $row->openletter; ?></td>
            <td><?php echo $row->open_id; ?></td>
            <td><input type="button" value="add to archieve" onclick="<?php echo $row->from; ?>" /></td>
            <td><input type="button" value="add to new" onclick="" /></td>
            <td><input type="button" value="Discard" onclick="" /></td>
        </tr>

    <?php endforeach; ?>
</table>
2
  • 3
    How to pass values as usual by request Commented May 28, 2015 at 6:55
  • DO you know what the form does??? Commented May 28, 2015 at 6:59

1 Answer 1

2

Use this

<td>
<input type="button" value="add to new" onclick="<?php echo base_url()?>index.php/controller/function" />
</td>
<td>
<input type="button" value="Discard" onclick="<?php echo base_url()?>index.php/controller/function" />
</td>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.