This question already has an answer here:
- Notice: Undefined index [duplicate] 4 answers
How can I define my $_POST
variables in below sample code before submission to prevent PHP Undefined index notice.
HTML sample code:
<form action="" method="post">
<input type="text" name="my_input" id="my_input">
<button type="submit">Submit</button>
</form>
my php sample code:
$post_variable = $_POST["my_input"];
Thanks in advance.
</div>