php


php mysql: not accepting unchanged form inputs


I have noticed that if I submit my form using
<form method="post" action="">
and changing at least one of the input's value it is working fine, I mean my save() function is working and saving my records to database.
However, if none of the input values are changed, else {} block is executed which is false for save().
Can anybody explain why it is so?
You may be using something like
if($query->affected_rows()>0){
return true;
}else{
return false
}
After doing the database save sql query. So, when changes are made in the form fields, the changes are saved and the first condition becomes true returning true. But when no changes are made in the form field, i.e if the fields are kept intact, no changes is made to the database and the second, i.e else condition gets executed returning false.
UPDATE
I could be able to explain it to you more clearly if you post the code. There is nothing wrong with the html form code that you have posted. But you need to post the PHP code which is handling the save operation.
You can keep the old values in somewhere. When user posts the form, you can check it out if anything is changed.

Related Links

trim lines and shrink whitespaces using regex for multi line string
How to change if value 1 to get like General
Image upload and resize function not working as it must
Return post date in specific format wordpress
php array / multidimensional sort
PHP return result from a loop
Symfony2 API - Best way to import and save a CSV file
Use of undefined constant while storing data from form
Issues with installing codesniffer in netbeans - windows7
Address Parsing PHP Regex
Change Facebook's Shared URL Meta Information Via PHP
sending value from php page to selection tag using request
How to update all values from a field using mysql?
Updating Existing Column Attributes - Laravel 5 Migration
Detecting if a group of words was mentioned
Woocommerce's functions shortcode

Categories

HOME
qt
initialization
android-emulator
nsis
material-components
hyperledger
fedora
specifications
buffer
google-awareness
trace32
mahout-recommender
uima
mixpanel
hidden
rpmbuild
maven-plugin
error-logging
weex
web-analytics
amazon-sns
web-push
crud
android-service
laravel-4.2
basic-authentication
intune
instructions
wampsharp
lxml
gsp
xmlunit
jade4j
eclipse-gmf
strapi
widestring
coverage.py
expandablelistview
code-push
jenkins-slave
cloudwatch
brightscript
datediff
webvtt
exc-bad-access
email-forwarding
portal
libharu
livecycle
coovachilli
nsdata
apple-configurator
swiffy
univocity
relational-model
erlog
mgwt
sql-processor
operands
comctl32
flurry-analytics
windows-rt
squeezebox
maven-central
zend-search-lucene
xulrunner
sql-view
hints
microformats
chartfx
oscilloscope
story
algol68
background-repeat
asio
glassfish-esb
azure-acs
css-friendly
airprint
eaccelerator
oracle-pro-c
yahoo-maps
efs

Resources

Encrypt Message