Search code examples
phpformsjoomlajoomla3.2

Joomla 3.2 Submit form via GET method to a view


I am developing a search feature where the search parameters are going to be submitted via GET Method of the form, (url shall be stored) with the intention of getting seo points for having the terms in url.

So for a form which searches venues in cities....

 <form action="index.php?option=com_wedd&view=search&layout=default" id="searchVenue" name="searchy" method="get">
                    <input name="city" type="text" id="city" class="updform" placeholder="City"/>
                    <input name="location" type="text" id="loc" class="updform" placeholder="Location"/>
                    <select name="venuetype" id="selVenueType">
                        <option selected="selected" value="">All</option>
                        <option value="Blah">Blah!!</option>
                    </select>
                    <input name="date" type="text" id="date" class="updform" placeholder="Date"/>
                    <input name="submit" type="submit" value="Search"/>
                    <?php echo JHtml::_('form.token'); ?>
 </form>

Now the form when submitted, redirects back to the homepage.

How I'd like the url of the results page to look like..

blah.com/index.php?option=com_wedd&view=search&layout=default&city=newyork&location=WhitePlains

This had me pulling my hairs for hours, so finally here i ask.

NOTE:- I must add that method='post' works great and I can print_r the post data in the view, but sadly its only the get method that suffers.


Solution

  • Ok, I got this working by using this answer

    I still dont know how or why this is happening, but its working for me so I got that going for me, which is nice.