Error trying to recover $_GET value in Submit

Asked

Viewed 166 times

2

My system does a target search before opening the registration form, in this search I take the Destinoid parameter and enter the input.

inserir a descrição da imagem aqui

The problem is that when I click on save it fails to do Destinoid input value Submit.

This is the line that recovers the value passed in the parameter:<input type="number" maxlength="11" class="form-control" name="DestinoID" value="<?php echo $_GET['DestinoID']; ?>" disabled>

Someone can help me?

  • 1

    Alter disabled for readonly

2 answers

7


This is probably because you have disabled the field DestinoID defining the property disabled. 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 property readonly:

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

In the recommendation W3C has defined that:

Therefore, it cannot receive user input nor will its value be submitted with the form.

Translating: a field defined as disabled cannot receive user entries or have their value submitted with the form.

3

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

  • Thanks, it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.