Can anybody see where I have gone wrong? I am trying to get the value of a field in a form via POST.
The field is disabled and pre-filled.
<form method="POST" action="actions/remove-daily-recipient.php">
<input type="text" name="recipientemail" value="email@email.com" disabled />
<input type="submit" value="Remove"/>
</form>
The form submits correctly and goes to my script remove-daily-recipient.php
However the first line of this script, which should grab the value of the email field, gets an error:
$email = htmlspecialchars($_POST["recipientemail"]);
echo $email;
// The error
Notice: Undefined index: recipientemail in [path/name] on line 5
What would be the cause of this?
A few things I am thinking:
- There are multiple forms on the page. However shouldn't the submit button within that form only fire and POST the data filled in on that particular form? It shouldn't affect any other forms?
- The data is pre-filled and the field is disabled. Would it not like this? I think it should be able to get data from a pre-filled and disabled field?
Thanks!