Welcome Guest, Not a member yet? Register   Sign In
Passing of parameters
#1

[eluser]GrootBaas[/eluser]
Hi all,

Let me just start of by saying that I am very new to web development.

I am struggling to send a parameter from an HTML form to my controller to be saved and used later.

The parameter is not from an input field, but rather send from the controller in an array.

Code:
$this->layout->buildPage ( 'quote/values', $data );

I open the array $data and loop through in the HTML form. As I now have looped through the array, I have my parameter, and would like to send that back to my controller.

Please help me? It would be very much appreciated.

I thought about ...

Code:
<?=form_hidden('rev_no',(isset($rev_no) ? $rev_no : ''))?>

But it sems not to work :down:
#2

[eluser]crumpet[/eluser]
can you provide the code where you loop through the array and your controller as well
#3

[eluser]GrootBaas[/eluser]
This is my controller ...

Code:
$this->quotemodel->get_quote_details ( $this->quote ['quote'] ['quo_id'], $this->quote ['quote'] ['quo_rev'], $this->quote ['quote'] ['qmd_id'], getUserId (), $data ['quote_det'], $data ['qel_det'], $data ['finance_det']);
        
        $jscript = array ( );
        $jscript [] = 'jquery.jqmodal.js';
        $jscript [] = 'jquery.dimensions.pack.js';
        $jscript [] = 'jquery.gradient.js';
        $jscript [] = 'jquery.rating.js';
        $jscript [] = 'ui.mouse.js';
        $jscript [] = 'ui.slider.js';
        
        $data ['jscript'] = $jscript;
        $this->put_cookie_values ();        
        
        $this->layout->buildPage ( 'quote/values', $data );

This is my Form where I loop through he cursor ... I am looking to return $quote['QUOTE_NO']

Code:
echo "<table>";
    while ( $quote = oci_fetch_assoc($quote_det)) {
        
        echo "<tr>\n";
        echo "<td width=86><strong>Quote No:</td>";
        echo "<td width=220 align=\"left\">".$quote['QUOTE_NO']."/".$quote['REVISION_NO']."</td>";
        echo "</tr>";

    echo "<tr>\n";
        echo "<td width=86><strong>Term:</td>";
        echo "<td width=220 align=\"left\">".$quote['CONTRACT_PERIOD']."</td>";
        echo "<td width=86><strong>Manufacturer:</td>";
        echo "<td width=300 align=\"left\">".$quote['MAKE_DESC']."</td>";
    echo "</tr>";
                
    echo "<tr>\n";
        echo "<td width=86><strong>Distance:</td>";
        echo "<td width=220 align=\"left\">".$quote['CONTRACT_DISTANCE']."&nbsp;".$quote['UOM_CODE']."</td>";
        echo "<td width=86><strong>Model:</td>";
        echo "<td width=300 align=\"left\">".$quote['MAKE_MODEL_DESC']."</td>";
    echo "</tr>";
                
echo "</table>";
#4

[eluser]Nikhil Vijayan[/eluser]
dude i cant see $quote assigned anywhere.. how could you get data in it ?
#5

[eluser]GrootBaas[/eluser]
Right at the top of my form... I assign ...

Code:
$quote = oci_fetch_assoc($quote_det)

Or am i missing your point?
#6

[eluser]GrootBaas[/eluser]
The form works, everything is cool. I just need to return

$quote['QUOTE_NO']

back to my controller.
#7

[eluser]Nikhil Vijayan[/eluser]
[quote author="GrootBaas" date="1213354972"]The form works, everything is cool. I just need to return

$quote['QUOTE_NO']

back to my controller.[/quote]

Return quote_no when submiting the form ???

EDIT : also is that code u pasted the exat code u use .. ? if yes i cant see any hidden elemnt... also make sure u have form tags opened and closed correctly
#8

[eluser]GrootBaas[/eluser]
The form is only a display screen.

If we need a time for the post, I would say when the user press the button "order", on the display screen...

Code:
<table width="100%">
  <tr>
      <td align="left">&lt;?=form_submit(array('id' => 'button', 'name'=>'btn_elements', 'value' => '<<< Prev')); ?&gt;</td>  
    <td align="right">&lt;input id="button" type="button" value="Print" onclick="window.open('&lt;?=$this-&gt;config->item('quote_print_url').$qmd_id ?&gt;')"> </td>
    <td align="right">&lt;?=form_submit(array('id' => 'button', 'name' =>'btn_order', 'value' => $this->lang->line('quo_progress_button'))); ?&gt;</td>
  </tr>
</table>
#9

[eluser]Nikhil Vijayan[/eluser]
make sure the hidden element of qoute_no and the submit button is inside the same &lt;form name=""&gt;&lt;/form&gt; tags
#10

[eluser]GrootBaas[/eluser]
Is that the way to do it...

Must I try to get the hidden element thing going, or should I try another method.

What I mean is ...

Is form hidden element the way to pass parameter to the controller?




Theme © iAndrew 2016 - Forum software by © MyBB