Welcome Guest, Not a member yet? Register   Sign In
passing variables from view to controller and after displaying in uri
#1

[eluser]jonny68[/eluser]
Hi,

i'm trying my best to build a catalogue with CI,

what i'd need is passing variables from a submit in my view to a controller and changing

the uri for the next product after passing through the controller, of course i'd need as

well that a user can go straight to the product simply trough the url..

MY VIEW:

<h1>&lt;?php echo $mod;?&gt;</h1>
&lt;?php echo img($this->config->item('images').'/'.$img);?&gt;
<p>&lt;?php echo $text;?&gt;</p>
&lt;!--------Button to redirect user to the other product-------------&gt;
&lt;?php
echo form_open('shoes/modello');
$data = array(
'mod' => 'Winter Shoes',
'name' => 'Kindra',
'img' => '2black',
);
echo form_hidden($data);
echo form_submit('submit', 'Kindra Shoe');
echo '&lt;/form&gt;';
?&gt;
&lt;!-----------end button-----------------&gt;

MY CONTROLLER function:

(I KNOW I CAN PASS PARAMETERS FOR THE URL IN THE CONTROLLER BUT HOW?,
BASECLY I'D LIKE WHEN I CLICK THE BUTTON IN THE VIEW TO BE REDIRECT TO THE SAME VIEW
BUT WITH DIFFERENT PARAMETERS THE ONES TAKEN FROM THE BUTTON AND DIPLAYING IT TO THE URL)

p.s: Sorry i know i sound stupid but i'm just aproaching MVC.. Smile

public function modello($mod,$img) {

$data['main_content'] = 'iphone/modello_view';
$this->load->view('template',$data);
}

THANKS A LOT!




Theme © iAndrew 2016 - Forum software by © MyBB