How to get the value from a text field and pass it into a variable?
20,237
Every time you hit the submit button, it will post the value of the input. This will set your PHP variable every time.
Update: Patrioticcow said his variable isn't returning anything. Something that should have been included in the question, but now we have that information.
echo $yourvariable;
Instead of print. This will work.
Comments
-
Patrioticcow about 4 years
I have the following form.
<form name="cookieform" id="login" method="POST"> <input type="text" NAME="username" id="username" class="text" maxlength="30" /> </form>
What I would like to do is to grab the value from the text field and place it into a PHP variable. I have the following code.
<?php $get_username = $_POST['username']; print($get_username); ?>
thanks