Could you please help me solve this problem? I’ve been trying to post a content in a text box and try to display it using PHP ‘echo’ but it keeps displaying “Undefined index” and the content of the textbox is not posted. Here’s the code:
<?php
if (isset($_POST['updateaccount'])) {
$accountType = $_POST['typeBox'];
echo $accountType;
}
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>">
<table>
<tr>
<td><strong>Account Type<strong></td>
<td><input type="text" name="typeBox" value="This is a test." disabled="true"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="updateaccount" value="Update Account"></td>
</tr>
</table>
</form>
Whenever I try to submit the form, it says:
Notice: Undefined index: typeBox in C:\xampp\htdocs\cel1rcfc\test.php on line 5
Because you set the attribute
disabled="true", disabled input element will not be posted to the server side.