PHP Form
Posted: Tue Jan 18, 2011 6:59 pm
I'm creating a wordpress template that will have a menu with settings for look and layout of the site. One of the settings is having a way to change the header of the site, either have text or an image. I want to have two options with radio buttons, one for "Text" and one for "Image." I know how to create the form and get it to callout to the sites header. What I am having a problem with is, I want the "Text" option to be the default setting. Then the user can click the "Image" radio button to upload a custom header image. What I need help with, I guess, is the use of "if" and "else" commands. When one radio button is selected there is an output to the header, then when the other radio button is selected something different is outputed to the header.
Here is the base form code I have. I have tried different commands and can not seem to get it to work.
I know know the "Image" selection isn't an upload form. I have that made already that will be pasted into this code once I get the radio buttons to work right.
Here is the base form code I have. I have tried different commands and can not seem to get it to work.
Code: Select all
<?php settings_fields('bpt-settings-group'); ?>
<table class="form-table">
<tr valign="top">
<th scope="row"><input type="radio" name="Header Type" value="Text" />Header Text:</th>
<td><textarea style="width:50em; height: 27px;" name="header_text"><?php echo get_option('header_text'); ?></textarea></td>
</tr>
<tr valign="top">
<th scope="row"><input type="radio" name="Header Type" value="Image" />Header Image:</th>
<td><textarea style="width:50em; height:27px;" name="header_image"><?php echo get_option('header_image'); ?></textarea></td>
</tr>
</table>