I want to get the value of a textbox in PHP, and when I try this:
<form method=post action="update.php">
<input type="text" name="Hex" />
<input type="submit" value="OK" />
</form>
<?php
$test = $_POST['Hex'];
echo $test;
?>
I just get the error:
Undefined index: Hex
I've Googled to no avail; so please someone, help me!
i think the issue is with the quotation marks, @GuiceU you forgot to add the quotes to post.
Just replace your method = post with method="post"
HTML code:
<form method="post" action="update.php">
<input type="text" name="Hex" />
<input type="submit" value="OK" />
</form>
php code:
<?php
$test = $_POST['Hex'];
echo $test;
?>
I hope this help you:
<?php
if (isset($_POST['submit'])) {
$test = $_POST['Hex'];
echo $test;
} else { ?>
<form method="post" action="">
<input type="text" name="Hex" />
<input type="submit" value="OK" name="submit" />
</form>
<?php } ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With