I have an input box where a user can input a number and then that number will be outputted into an html page. It all works fine except when you enter in the number 0 it doesn't output anything but it needs to say 0. This is a live baseball game scoring plugin I wrote for WordPress so I need "Inning 1" to read "0" if no runs were scored. Here is the gist of my code:
$t1Inning1 = ( $instance['t1Inning1'] ) ? $instance['t1Inning1'] : '-';
<div><?php echo $t1Inning1 ?></div>
<label for="<?php echo $this->get_field_id('t1Inning1'); ?>">
<input id="<?php echo $this->get_field_id('t1Inning1'); ?>"
name="<?php echo $this->get_field_name('t1Inning1'); ?>"
value="<?php echo esc_attr( $instance['t1Inning1'] ); ?>"
maxlength="2" size="3" />
</label>
You can see the output at http://juniorregionals.com/ in the middle left. The '-' is just the default value which doesn't change when you input 0 in the plugin and save it but again I need it to read 0 if you input 0.
Let me know if I need to be more specific