SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict sparkdigital's Avatar
    Join Date
    Feb 2005
    Location
    Kendal, Cumbria - The Lake District, UK
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Problem with submitting this form with method=get - Adds coordinates to url

    Hi,

    I'm integrating (or at least, attempting to integrate ) this online booking form for a client. The programmers there aren't very helpful and I can't seem to get it working properly.

    Here's the code for the form:

    Code:
    <form name="book_online" action="http://www.xxxxxx.net/connect.asp?id=121"  method="get" onsubmit="window.open('about:blank', 'resultsPage', 'height=600,width=800,scrollbars=yes');" target="resultsPage">
    <b>Check availability</b><br />
    	<input name="id" type="hidden" value="121" />
    	<input name="mode" type="hidden" value="dates" />
    	<label>Date:</label> <select name="arrival_day">
    					<option value='01'>01</option>
                        <option value='02'>02</option>
                        <option value='03'>03</option>
                        <option value='04'>04</option>
                        <option value='05'>05</option>
                        <option value='06'>06</option>
                        <option value='07'>07</option>
                        <option value='08'>08</option>
                        <option value='09'>09</option>
                        <option value='10'>10</option>
                        <option value='11'>11</option>
                        <option value='12'>12</option>
                        <option value='13'>13</option>
                        <option value='14'>14</option>
                        <option value='15'>15</option>
                        <option value='16'>16</option>
                        <option value='17'>17</option>
                        <option value='18'>18</option>
                        <option value='19'>19</option>
                        <option value='20'>20</option>
                        <option value='21'>21</option>
                        <option value='22'>22</option>
                        <option value='23'>23</option>
                        <option value='24'>24</option>
                        <option value='25'>25</option>
                        <option value='26'>26</option>
                        <option value='27'>27</option>
                        <option value='28'>28</option>
                        <option value='29'>29</option>
                        <option value='30'>30</option>
                        <option value='31'>31</option>
                        </select>
                        
    	<select name="arrival_month">
    					<option value='01'>01</option>
                        <option value='02'>02</option>
                        <option value='03'>03</option>
                        <option value='04'>04</option>
                        <option value='05'>05</option>
                        <option value='06'>06</option>
                        <option value='07'>07</option>
                        <option value='08'>08</option>
                        <option value='09'>09</option>
                        <option value='10'>10</option>
                        <option value='11'>11</option>
                        <option value='12'>12</option>
                        </select>
    
    	<select name="arrival_year">
    					<option value="2008">'08</option>
                        <option value="2009">'09</option>
                        <option value="2010">'10</option>
                        </select><br />
    
    <label>Number of nights:</label> <select name="no_of_nights">
    			<option value="1">1</option>
    			<option value="2">2</option>
    			<option value="3">3</option>
    			<option value="4">4</option>
    			<option value="5">5</option>
    			<option value="6">6</option>
    			<option value="7">7</option>
    			<option value="8">8</option>
    			<option value="9">9</option>
    			<option value="10">10</option>
    			<option value="11">11</option>
    			<option value="12">12</option>
    			<option value="13">13</option>
    			<option value="14">14</option>
    		</select>
    <br />
    <label>
    <input type="image" src="<?php echo TEMPLATE_DIR; ?>/img/check.gif">
    </label>
    </form>
    This should produce a url like this:

    Code:
    http://www.xxxx.net/connect.asp?id=121&mode=dates&arrival_day=01&arrival_month=01&arrival_year=2008&no_of_nights=1
    but instead it adds the coordinates of where I clicked on the button so the link doesn't work anymore:

    Code:
    http://www.xxxx.net/connect.asp?id=121&mode=dates&arrival_day=01&arrival_month=01&arrival_year=2008&no_of_nights=1&x=60&y=12
    Any idea what I'm doing wrong here?

    Thanks very much!

    Konrad
    Last edited by sparkdigital; Dec 19, 2008 at 08:26.

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's what happens if you have a submit button with type="image". To clarify, it's what's supposed to happen, so you're not doing anything wrong (except that you don't provide a text equivalent; the alt attribute is required for image buttons).
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Addict sparkdigital's Avatar
    Join Date
    Feb 2005
    Location
    Kendal, Cumbria - The Lake District, UK
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply! Which alterations would I have to make to create the correct required query as outlined in the first post (e.g. without the '&x=60&y=12')?

    Thanks,

    Konrad

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I didn't know better (and I don't), I'd suspect that the problem was on the server side (or could be "corrected" there by stripping those fields from the URI string that gets sent to the browser).

    But alas, I stick to the content and the way people use Web sites, so my idea about using server-side programming to fix this just might be overkill.

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The only way to get rif of the coordinates from the querystring is to not use <input type="image"> so if you need to use that then the only other option is to disregard those values when extracting the content from the querystring.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #6
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sparkdigital View Post
    Thanks for your reply! Which alterations would I have to make to create the correct required query as outlined in the first post (e.g. without the '&x=60&y=12')?
    What I was trying to say is that those parameters will be added if you use an <input type="image">. You can't make any alterations to remove them, short of using something other than an <input type="image">.

    Those parameters are supposed to be there if you use an image button. Don't fight it.
    Birnam wood is come to Dunsinane

  7. #7
    SitePoint Addict sparkdigital's Avatar
    Join Date
    Feb 2005
    Location
    Kendal, Cumbria - The Lake District, UK
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Thanks everyone for your input. You're right - when I replace the image with

    Code:
    <input value="Check Availability" type="submit">
    it does work. I'm now using this and css styles for the button to tie it in with the other buttons on the site.

    Thanks again for your help!

    Konrad


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •