SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2008
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Extra characters in URL string when viewing in IE

    Using a form with method="get" there are extra characters being sent to the URL so that the string looks like this:

    ?category=%0A%09%09%09%09%09Attractions&state=all&zip=&distance=

    The correct URL is not supposed to have %0A%09%09%09%09%09. The correct URL should look like this:

    ?category=Attractions&state=all&zip=&distance=

    I need to mention that this does not happen when submitting the form using Firefox, only when using IE to submit the form.

    Any help will be greatly appreciated.

    Here is my form code:

    <form action="member-discounts.php?action=distance&" method="get" name="zipform" enctype="application/x-www-form-urlencoded">
    <?php if(isset($_SESSION['search'])) $s = $_SESSION['search']; ?>
    <p><select name="category">
    <option value="all" <?=(isset($s['category']) && $s['category'] == 'all') ? 'selected="selected"' : ''?>>Select Category...</option>
    <?php
    $query_cats = mysql_query(" SELECT DISTINCT(merchant_det_business_desc)
    FROM amac_merchant_details
    WHERE
    merchant_det_company<>''
    AND
    merchant_det_business_desc<>''
    AND
    merchant_det_referred_by<>'amac enrollment form'
    ORDER BY merchant_det_business_desc ASC");
    while($res_cat = mysql_fetch_assoc($query_cats)){
    ?>
    <option value="
    <?=$res_cat['merchant_det_business_desc']?>" <?=(isset($s['category']) && $s['category'] == $res_cat['merchant_det_business_desc']) ? 'selected="selected"' : ''?>><?=$res_cat['merchant_det_business_desc']?>
    </option>
    <?php } ?>
    </select></p>

    <?php } ?>
    </form>

  2. #2
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,397
    Mentioned
    63 Post(s)
    Tagged
    0 Thread(s)
    Those extra characters are whitespace in the value attribute of the options: more precisely, a new line character followed by five horizontal tab characters.

    Simply remove the newline and tabs after this <option value=" and before <?=$res_cat towards the end of the code that you posted.
    Salathe
    Software Developer and PHP Manual Author.

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2008
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you, and thank you very much.

    And the world keeps on spinnin'


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
  •