Url from a form

F

f8lerror

Okay,
You know how you can use google to search for things and use
+description or -adult stuff like that
how can I have a user enter whatever into a form and add the input to
the end of a search string that I made up I either get an error from
google or a blank google page.

<body>
<form method=get form
action="http://www.google.com/search?hl=en&lr=&safe=on ">
<input name="s" size=30>
<input type=submit>
</form>
</body>
</html>
thanks
 
J

John Dunlop

(e-mail address removed):

This is problematic. 'If the method is "get" and the action is an
HTTP URI, the user agent takes the value of action, appends a `?' to
it, then appends the form data set'. So if the URL in the action
attribute already has a query part, the URL created by the form will
have two question marks. The second question mark, the one actually
_in_ the query part, is data rather than a delimiter. To take your
example, with a non-empty form data set, the 'safe' variable - assuming
"variables" are separated by '&' - would have a value of 'on?' plus the
control-name, '=', and control-value of the first item in the form data
set.

There is no single production in the URI std that the HTML spec could
have pointed to to say 'the value of the action attribute must be
this'. What it could have said was that if the method is GET then the
URL in the action attribute must not have a query part.

site:google.com
 
S

Steven Saunderson

Okay,
You know how you can use google to search for things and use
+description or -adult stuff like that
how can I have a user enter whatever into a form and add the input to
the end of a search string that I made up I either get an error from
google or a blank google page.

Can you try hidden fields before or after your text field ?

<form method=get
action="http://www.google.com/search">
<input type="hidden" name="h1" value="en">
<input type="hidden" name="lr" value="">
<input type="hidden" name="safe" value="on">
<input name="s" size=30>
<input type=submit>
</form>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top