Check "input type" if value is empty then insert default text
I'm not very advanced so it takes me a long time to get anywhere but I persist and so far have gotten this to work:
<input type="text" name="product_desc[<?php echo $language['language_id']; ?>][tab_extra]" size ="50" value="<?php echo isset($product_desc[$language['language_id']]) ? $product_desc[$language['language_id']]['tab_extra'] : ''; ?>" />
It looks to the database and displays the value, but allows me to update, delete or change the text that is contained there. Great, except most of the time I need that tab to be called 'Extra' and only rarely will I ever need to change the title. I was thinking of using placeholder but that doesn't really do what I need it to do.
I'm thinking an IF...ELSE statement could work, something like IF tab_extra is empty than display the word 'Extra' by default in the input box. My searches always come up empty because of all the "how do I clear the default value on click" questions that exist, and that's not what I want to do at all.
So to wrap up...look at the database and if the field is empty, add the word 'Extra' to be inserted into the database.
When selecting from a MySQL database, if you have a table like
table baz: foo bar ========= ========= value1 NULL value2 Optional value3 NULL
and want to retrieve the word "Extra" wherever the "bar" column is NULL, then you can use the coalesce function
select coalesce(bar, 'Extra') as bar from baz;