Forum Moderators: coopster

Message Too Old, No Replies

Stray characters in URL using GET

         

salewit

7:03 pm on Nov 20, 2007 (gmt 0)

10+ Year Member



I've got a home-made search routine. On search entry page I have (simplified):

<form action="searchpage.php" method="get">
<input type="text" name="search">
<input type="submit" value="Go">
</form>

In my URL from this page, I have: http://www.example.com/searchpage.php?search=foo+search&x=0&y=0

The X & Y variable I can't trace where they're coming from. I've looked on every file I can't find any reference to anything being named. Can you they come from OUTSIDE of an INPUT tag and if so where? What's more maddening is that when I go to different places in my site, and search (the search feature is available from every page), those two variables change. It's driving me nuts. I'm concerned mostly about search engines dinging me for dupe content.

[edited by: eelixduppy at 7:07 pm (utc) on Nov. 20, 2007]
[edit reason] switched to example.com [/edit]

mooger35

7:13 pm on Nov 20, 2007 (gmt 0)

10+ Year Member



From what I remember reading the X & Y are submitted from your form if you are using an image as a submit button.

salewit

8:37 pm on Nov 20, 2007 (gmt 0)

10+ Year Member



Hmmm... yeah I AM using an image for a button! But how would that cause the X & Y values to be different every time? It's definitely not the dimensions of the button. Any idea how to suppress it?

mooger35

8:52 pm on Nov 20, 2007 (gmt 0)

10+ Year Member



The coordinates change depending on where you click the button.

Looks like you are stuck with them unless you use a regular button.

[webmasterworld.com...]

[edit]

actually...

if you put this at the top of your "searchpage.php" file you should suppress the coordinates.

<?php
if(isset($_GET['x'])) header("location:searchpage.php?search={$_GET['search']}");
?>

Kings on steeds

1:30 pm on Nov 21, 2007 (gmt 0)

10+ Year Member



you could also void them by using javascript to submit your form.


<script>
function submitForm(formName){
document.forms[formName].submit;
}
</script>
<form method='GET' action='searchpage.php' name='search>
<input type='text' name='q' value='search..' onClick="this.value=''" /><br />
</form>
<a href='javascript:;' onClick='submitForm("search");'><img src='yourimage.jpg' /></a>

untested but something like that should work and avoid your x & y's

[edit] this would not be degradable so if they had JS off you wouldnt be able to submit your form. so have a <noscript> tag to take them to a normal form..[/edit]

Enjoy
Alan

[edited by: Kings_on_steeds at 1:33 pm (utc) on Nov. 21, 2007]