Html append text value to form action


I have a form, text input and a submit button. How do I append the value of the text box to the form action i.e.

action="" & txtSessionId

The form looks like this:

<form name="form1" method="post" action="">
  <label>Your Sessions ID:
    <input type="text" name="txtSessionId" id="txtSessionId">
<input type="submit" name="btnContinue" id="btnContinue" value="Continue">

I want the link to look like this:

where 123456 is typed into the text box by the user.

Thank you

Best Solution

You'd have to either use javascript or something server-side to do that (or both).


<form name="form1" method="post" action="" 
  onsubmit="location.href = this.action + this.txtSessionId.value; return false;">

Server-side (PHP)

if (!empty($_POST['txtSessionId']))
    header('Location: https://.....' . (int)$_POST['txtSessionId']);