html - Post the only modify input field php -


I have 10 input fields here, then when I submit the click button to the user, then I need only the input field All input fields sent to the database send the database and updates instead.

How can I get it?

If you want to save the field that the user has touched, see the first version but a downside That if the user changed "ABC" to "xyz" and then changed it to "ABC" then the field will be marked by changing if it is not what you want, see the next version.

(1)

You can use the onchange () event in your area to modify a variable when the field is modified. Then send these variables to the server using the input hidden field. By the way:

   & Lt; Input type = 'hidden' name = 'input2changed' value = 0>   

Then in your PHP code:

  if ($ _POST ['input1changed']) $ _POST store ['input1'] if ($ _POST ['Input2changed']) Store $ _POST ['input2']   

(2)

  & lt; Input type = 'hidden' name = 'input1old' value = 'sometext1' & gt; & Lt; Input type = 'text' name = 'input1' value = 'some time ago' & gt; & Lt; Input type = 'hidden' name = 'input2 old' value = 'some pre 2' & gt; & Lt; Input type = 'text' name = 'input1' value = 'some pre 2' & gt;   

and in PHP:

  if ($ _POST ['input1old']! = $ _POST ['input1']) $ _POST store 'input1 '] If $ [_POST [' input2old '] = $ _POST [' input2 ']) store $ _POST [' input2 ']    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -