Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pass form input value to action

I have a page (module-access.php).

On the page I have a form with one text input field. I'd like to set whatever is typed in this field to be part of the form's action.

<form action="module-access.php?company=THE-USERS-INPUT" method="post" name="company" id="company">
Company Name: <input type="text" name="textfield" id="textfield">
<INPUT TYPE="submit" name="submit" VALUE="Go"></FORM>

Thanks

like image 987
Adam Avatar asked Feb 25 '23 00:02

Adam


1 Answers

Just change the input name from textfield to company and the action type to GET

<form id="myform" action="module-access.php" method="GET">
    Company Name: <input type="text" name="company" id="company">
    <input type="submit" name="submit" value="Go">
</form>
like image 116
mrtsherman Avatar answered Feb 26 '23 21:02

mrtsherman