Default value to drupal variable I have a piece of code that I want to have the default value be a variable, but I need to know how to set a default value if the variable is not set:

  $form['background_audio_height'] = array(
'#type' =&gt; 'textfield',
'#title' =&gt; t('Subject'),
'#default_value' =&gt; variable_get('background_audio_upload_path'),
'#size' =&gt; 5,
'#maxlength' =&gt; 3,
'#required' =&gt; TRUE,
);


How can I set a default value if background_audio_upload_path is not set?
You can pass a second variable to the variable_get() function, which is a default value.

example:

variable_get('background_audio_upload_path', 'path/to/foo.bar');