Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to generate a specific url from the form below. There will be a calendar and the date will go into the url. Also a value from 9 ticket types and quantities of each of those tickets. So my url will look something like this

https://sales.site.com/?action=quicksale&venueid=1&businessdate=2012-10-05&ticketids=6,8&quantities=1,1

With these values: action: always "quicksale", venueid: always "1", businessdate: the sales date requested; can be either mm-dd-yyyy or yyyy-mm-dd, ticketids: see chart below, quantities: in the order the ticketid's are listed.

How would I approach this, and should I use php or jquery? Post or Get. Should the calendar be Jquery?

Looking for advice, thanks

                        <form method="post" action="">-->
            <div class="quick-book-form-elements">
                <table width="255" class="quick-book-table" cellpadding="4">
                    <tbody>
                        <tr class="quick-book-days">
                            <th>&nbsp;</th>
                            <th><img src="../public/img/1day-small.png" alt="" /></th>
                            <th><img src="../public/img/2day-small.png" alt="" /></th>
                            <th class="quick-book-last"><img src="../public/img/3day-small.png" alt="" /></th>
                        </tr>

                        <tr class="quick-book-adults">
                            <th class="quick-book-labels">
                                Adult
                            </th>
                            <td>
                                <div class="ticket-style-quick-book">
                                    <select class="adult-ticket-select">
                                        <option value="0">0</option>
                                        <option value="1">1</option>
                                    </select>
                                    <span class="quick-book-price">$40/ea</span>
                                </div>
                            </td>

                            <td>
                                <div class="ticket-style-quick-book">
                                    <select class="adult-ticket-select">
                                        <option value="0">0</option>
                                        <option value="1">1</option>
                                    </select>
                                    <span class="quick-book-price">$50/ea</span>
                                </div>
                            </td>
                            <td class="quick-book-last">
                                <div class="ticket-style-quick-book">
                                    <select class="adult-ticket-select">
                                        <option value="0">0</option>
                                        <option value="1">1</option>
                                    </select>
                                    <span class="quick-book-price">$60/ea</span>
                                </div>
                            </td>
                        </tr>

                        <tr class="quick-book-child">
                            <th class="quick-book-labels">Child</th>
                            <td>
                                <div class="ticket-style-quick-book">
                                    <select class="adult-ticket-select">
                                        <option value="0">0</option>
                                        <option value="1">1</option>
                                    </select>
                                    <span class="quick-book-price">$30/ea</span>
                                </div>
                            </td>
                            <td>
                                <div class="ticket-style-quick-book">
                                    <select class="adult-ticket-select">
                                        <option value="0">0</option>
                                        <option value="1">1</option>
                                    </select>
                                    <span class="quick-book-price">$40/ea</span>
                                </div>
                            </td>
                            <td class="quick-book-last">
                                <div class="ticket-style-quick-book">
                                    <select class="adult-ticket-select">
                                        <option value="0">0</option>
                                        <option value="1">1</option>
                                    </select>
                                    <span class="quick-book-price">$50/ea</span>
                                </div>
                            </td>
                        </tr>

                        <tr class="quick-book-family">
                            <th class="quick-book-labels">Family</th>
                            <td>
                                <div class="ticket-style-quick-book">
                                    <select class="adult-ticket-select">
                                        <option value="0">0</option>
                                        <option value="1">1</option>
                                    </select>
                                    <span class="quick-book-price">$125/ea</span>
                                </div>
                            </td>
                            <td>
                                <div class="ticket-style-quick-book">
                                    <select class="adult-ticket-select">
                                        <option value="0">0</option>
                                        <option value="1">1</option>
                                    </select>
                                    <span class="quick-book-price">$155/ea</span>
                                </div>
                            </td>
                            <td class="quick-book-last">
                                <div class="ticket-style-quick-book">
                                    <select class="adult-ticket-select">
                                        <option value="0">0</option>
                                        <option value="1">1</option>
                                    </select>
                                    <span class="quick-book-price">$185/ea</span>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        <a href="http://sales.site.com/" title="" class="quick-book-submit-btn"></a>
        <input type="submit" class="quick-book-submit-btn" name="quick-book-submit-btn" value="" />
    </form>
</div><!-- end quick-book-form div -->

share|improve this question

1 Answer

For the calendar, indeed you could use the jQuery-ui one. It is a good widget, easy to configure and very powerful.

http://jqueryui.com/demos/datepicker/

You can configure it to put the format you want in the input (YYYY-MM-DD for example)

Finally you should add a listener on the submit event, to perform your action modification:

// This function will be call before the submit
$("#YOUR_FORM_ID").submit(function(submitEvent) {

    // Initialize the query param array
    var queryParams = [];

    // Fill the query param with values
    queryParams.push("action=quicksale");
    queryParams.push("venueid=1");
    queryParams.push("businessdate=" + $("#YOUR_INPUT_DATE_ID").val());
    // etc...

    // Finally update the form action
    $(this).attr('action', 'https://sales.site.com/?' + queryParams.join("&"));

    // The action has been updated
    // The submit will process
});
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.