Inserting a specific (default) value
Posted: Tue May 20, 2008 3:51 am
I am using a PHP form which POSTS data to a PHP routine which uploads information to my database.
What I NEED to do is say to PHP (on CERTAIN fields only) that if there is no input (i.e. the text box is left blank) I want the value 'blank' inserted in to the row. This is because my database stores filenames (minus the .gif suffix) in certain columns. If no picture exists the default is blank.gif which is a 1px by 1px spacer.
i.e. echo "<img border=0 src='$photo1urn.gif'> where $photo1urn is either '1234' or 'blank'.
I've set up the MySQL database to use a default value of 'blank' for the required fields but when I submit my form the $_POST data overwrites the default value.
Am I making any sense?!
Kris.
What I NEED to do is say to PHP (on CERTAIN fields only) that if there is no input (i.e. the text box is left blank) I want the value 'blank' inserted in to the row. This is because my database stores filenames (minus the .gif suffix) in certain columns. If no picture exists the default is blank.gif which is a 1px by 1px spacer.
i.e. echo "<img border=0 src='$photo1urn.gif'> where $photo1urn is either '1234' or 'blank'.
I've set up the MySQL database to use a default value of 'blank' for the required fields but when I submit my form the $_POST data overwrites the default value.
Am I making any sense?!
Kris.