CodeIgniter Forums
Form Help question... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Form Help question... (/showthread.php?tid=20036)



Form Help question... - El Forum - 06-25-2009

[eluser]Jbeasley6651[/eluser]
I am using ci's form helper.

I am making a search on my site and i have a search box on the home page and then the same search box on the results page. (for the ability to refine the search)

What is the BEST way to pass this information from one form to the other?

Search box code

Code:
<?=form_open('search/results',array('id' => 'searchForm'))?>
<p>
<label>Bedrooms</label>
&lt;?php echo form_dropdown('beds', $numop);?&gt;
</p>
<p>
<label>Bathrooms</label>
&lt;?php echo form_dropdown('baths', $numop); ?&gt;</p>
<p>
<p>
<label>Price Minimum</label>
&lt;?php echo form_dropdown('price_min', $prices, '50000'); ?&gt;</p>    
<p>
<p>
<label>Price Max</label>
&lt;?php echo form_dropdown('price_max', $prices, '2500000'); ?&gt;</p>
<p>
<p>
    <label>MLS ID</label>
    &lt;input type="text" name="mlsid" value="" size="50" /&gt;
</p>
<p>
    <label>City</label>
    &lt;input type="text" name="city" value="" size="50" /&gt;
</p>
<p>
    &lt;input type="submit" value="Submit" class="btn" /&gt;
</p>
&lt;/form&gt;

Thanks in advanced.

~ Jbeasley


Form Help question... - El Forum - 06-25-2009

[eluser]Krzemo[/eluser]
I hope I got it right.
Checking for post data in search result controller and populating search box on search results page with it should do the thing.

Regards


Form Help question... - El Forum - 06-25-2009

[eluser]Thorpe Obazee[/eluser]
You can use the form_validation set_value() assuming you used it


Form Help question... - El Forum - 06-25-2009

[eluser]Jbeasley6651[/eluser]
i figured it out, i can just use $_POST['data']; in the form echo on the results page

Code:
&lt;?php echo form_dropdown('price_max', $prices, $_POST['price_max']); ?&gt;</p>