using if/else statement with str_replace to add variables via shortcode
<p>I'm working with a custom shortcode that generates a custom paypal button &amp; passes specific parameters to a paypal checkout form. </p>

<p>I'm using the str_replace function to pass attributes defined in the shortcode to the html form.  </p>

<p>I'd like to set a default style class &amp; default title if not defined as an attribute in the shortcode.  </p>

<p>My php:</p>

<pre><code>function paypal_button_func($attrs){


$class=$attrs['class']; //Added button style class variable 
$title=$attrs['title']; //Added button title variable 



if( isset( $atts['title'])) //add button title to the form html
{
return $html=str_replace('[title]',$title,$html); 
} 

//This sets the default title if not defined
else {
    return $html=str_replace ('[title]','SIGN UP NOW',$html); 
}
</code></pre>

<p>And this is my html</p>

<pre><code>&lt;input type="submit" class="[class]" value="[title]" /&gt; &lt;!-- updated class and value for addtl shortcode parameters --&gt;
</code></pre>

<p>I was successful with using the following code to pass the shortcode attributes to the html, but the problem is that if the attributes aren't defined in the shortcode it outputs the [class] and [title] as values, which is not what i want to happen.  </p>

<pre><code>$html=str_replace('[title]',$title,$html); //add button title assigned to the form    
$html=str_replace('[class]',$class,$html); //replaces class assigned to the form
</code></pre>