Samuelofc
Samuelofc

Reputation: 15

Adding a value to the end of a URL - HTML

I'm trying to add a value to the end of a url that's already preset.

So for example a user would type "hello world" into an input box, press submit and they would be taken to:

http://google.com/?q=hello%20world

Can I do this in HTML or will I need to include some PHP?

Any help would be fantastic. Thanks

Upvotes: 0

Views: 6589

Answers (2)

Vigrond
Vigrond

Reputation: 8198

This would be considered a GET request and is natively possible with HTML forms.

Example:

<form action="http://google.com" method="GET">

  <input type="text" name="q"/><br/>

  <input type="submit" value="Submit"/>

</form>

Once the submit button is clicked, the browser will make a GET request and direct the user to http://google.com/?q=value

Upvotes: 3

user557846
user557846

Reputation:

add a string to a string

if $str is "A" and $str2 is "B"

$str .=$str2;

results in $str being set to "AB"

Upvotes: 0

Related Questions