use and retain a field value if already set
Posted: Mon Mar 08, 2010 7:12 pm
I have a MYSQL DB with 4 fields that may or may not be set each time a logged in user accesses the input form.
What I would like to happen is if the field has a value then display it on the HTML/PHP form with the option to change it if required.
If a new value is not put into the input form box then the value originally there needs to be used/retained.
I have tried the following;
if (isset($row_settings['Height']))
{
$Height = $row_settings['Height'];
}
but this like the many other coding options tried before simply lose the original field value.
The FORM value name is Height - in this example.
Should I be using different FORM value name to the DB field name?
if so how do I code it.
Sorry I have googled this in many ways but do not seem to be able to sort it.
Could someone please advise the correct way to code this to achieve the desired result.
What I would like to happen is if the field has a value then display it on the HTML/PHP form with the option to change it if required.
If a new value is not put into the input form box then the value originally there needs to be used/retained.
I have tried the following;
if (isset($row_settings['Height']))
{
$Height = $row_settings['Height'];
}
but this like the many other coding options tried before simply lose the original field value.
The FORM value name is Height - in this example.
Should I be using different FORM value name to the DB field name?
if so how do I code it.
Sorry I have googled this in many ways but do not seem to be able to sort it.
Could someone please advise the correct way to code this to achieve the desired result.