Delete selected array in codeigniter

Hi, I don’t know how to explain or how do you call this method but to show what do I want to achieve. I have this code:

based on the picture, I want to delete a selected message by clicking the link. But I can’t think of any method how can I accomplish it. Here’s my view:

    <?php echo '<div class="modal-body">';?>
    			<?php if( !empty($unread) ) { 
    			$n = 0;							
    			foreach($unread as $row ){
    			echo '<div class="row" style="border-bottom: 1px dotted #111; margin-top: 15px;">';
    			echo '<div class="col-md-10">';
    			echo '<form id="deleteMessage['.$n.']" method="POST" role="form" accept-charset="utf-8">';
    			echo '<input type="hidden" id="hiddenMessageId" name="hiddenMsgId" value="'. $row->id .'">';
    			echo '<p style="color: #111;"><span><label>Message from: </label> '.$row->firstname. ' '.$row->lastname. ' Date: '  .$row->date. '</span></p><p style="color: #111;">';
    			echo '<p style="color: #111;"><span><label>Message: </label> '.$row->inquiry. '</span></p>';
    			echo '<p style="text-align:cener; color: green;"><span style="text-align:cener; color: green;">** End of Message **</span><span><a href="#" type="Button" value="Submit" name="delteinquiry['.$n.']" class="deleteMessage['.$n.']">Mark as read</a></span></p>';
    			echo '</form>';
    			echo '</div>';
    			echo '</div>';
   <?php echo '</div>';?>

Any help please. Thanks

any help guys.

Maybe do create a online function or specific function in a class that you will call from the form?

I don’t see a url in the form so let’s assume you want to stay on the same page.

Note I am on my phone :

$message = $_POST[‘id’];

// run a query where you set read to one.

// when done return to same page.

Sorry cannot type actual example code on my phone.
Bassicly you create a query and edit the message that you want to edit to mark it as read or completely delete the message.

Then return to same page if needed

I’ll try to think about the logic of that.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.