Reputation: 31
I have a HTML form like:
<form name="input" action="" method="post">
Username: <input type="text" name="user">
<input type="submit" value="Submit">
</form>
I need to build a URL when the submit link is clicked and send the user to it, using the username from the form in the correct position in the URL.
URL:
http://example.com/htmlchat/init.html?init_room=1&init_user=USERNAME_FROM_FORM_HERE
Can someone help (an example would be great)?
Upvotes: 1
Views: 1297
Reputation: 943537
such:
<form action="init.html">
<input type="hidden" name="init_room" value="1">
<label>
Username:
<input name="init_user">
</label>
<input type="submit" value="Submit">
</form>
Upvotes: 3
Reputation: 10159
This is possible with either Javascript or a server side language such as PHP. With Javascript you want to update the action
attribute.
You could use jQuery to do this.
Upvotes: 0