Error trying to retrieve value from $ _GET on submit

2

My system does a destination search before opening the registration form, in this search I get the DestinationID parameter and I enter the input.

TheproblemisthatwhenIclicksaveitcannotsubmitthevalueoftheinputDestinationID.

Thisisthelinethatretrievesthevaluepassedintheparameter:<inputtype="number" maxlength="11" class="form-control" name="DestinoID" value="<?php echo $_GET['DestinoID']; ?>" disabled>

Can anyone help me?

    
asked by anonymous 31.05.2017 / 02:06

2 answers

8

This probably happens because you have disabled the DestinoID field by setting the disabled property. By default, browsers do not send data in disabled fields. If you want this value not to be changed by the user, you can use the readonly :

<input type="number" ... name="DestinoID" readonly />

The W3C Recommendation has defined this:

  Therefore, it can not receive user input nor will it be submitted with the form.

Translating: A field defined as disabled can not receive user input or have its value submitted with the form.

    
31.05.2017 / 02:10
4

You need to remove "disabled". The value of a "disabled" field is not sent together with the form data. If you need to view it, try leaving readonly. If you do not need to display the field, you can use <input type="hidden" />

    
31.05.2017 / 02:11