Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi my question is :
how i can send information to a function in controller from view???
look at this :

HTML
<html>
    <head>
        <title>Show Links</title>
    </head>
    <body>
        <ul>

        <?php foreach ($query as $key): ?>
            <li><?php echo $key->file_name?>
           <a href="<?php echo base_url('index.php/upload/del'); ?>">Delete</a><br /></li>
        <?php endforeach; ?>
        </ul>
        <br />
        <hr />
        <a href="<?php echo base_url('index.php/upload/show_links'); ?>">refresh</a>
    </body>
</html>



i need send $key->file_name to one function in controller for delete
i don't know how i can :(
Posted

A view is told by the controller all the information it needs for generating an output representation to the user. It can also provide generic mechanisms to inform the controller of user input. In your case your code is business logic not input provided by user, so i suppose that information should be generated at Controller end if controller needs it.
 
Share this answer
 
can you help me? :(

i need help me
 
Share this answer
 
now i come in the controller

PHP
public function show_links(){
		//
		$get=$this->My_Model->select_entry('*');
			foreach($get->result() as $rows){
				echo $rows->file_name.anchor('upload/del','Delete').'<br />';
			}
			
			$this->load->view('show_links');
		
		
		
	}
    public function del(){
    	$this->My_Model->delete_entry();
    }


how i can understand which $rows->file_name is click delete for send 'del' function???
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900