The form is like below;
<form action="sendmail.php" method="get">
<input type="text" name="phone" id="phone" data-clear-btn="true">
<input type="text" name="name" id="name" data-clear-btn="true">
<input disabled="disabled" type="text" name="textinput-disabled" id="textinput-disabled" placeholder="Text input" value="<?php echo $info;?>">
</form>
$info = "type1"; and the $info works fine in the form.
but In the sendmail.php
$name=$_GET['name'];
$type=$_GET['textinput-disabled'];
$phone=$_GET['phone'];
I get the name and phone, but I can't get the value in the textinput-disabled. What's the problem here.
Disabled fields are not submitted. You can make it readonly or hidden, to get value when submitted.
<input readonly type="text" name="textinput-disabled" id="textinput-disabled" placeholder="Text input" value="<?php echo $info;?>">
Thats expected behaviour.
Instead use
<input readonly type="text"...
Or if you must use disabled for some reason, add a hidden field:
<input disabled="disabled" type="text" name="textinput-disabled" id="textinput-disabled" placeholder="Text input" value="<?php echo $info;?>">
<input type="hidden" name="hidden" value="<?php echo $info;?>">
$name=$_GET['name'];
$type=$_GET['hidden'];
$phone=$_GET['phone'];
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