title: Custom module add to cart success message Magento
body: <p>In my custom module I want to show the add to cart success message. 
  I have following piece of code in my .phtml file: </p>
  
  <pre><code>echo '&lt;form action="/checkout/cart/add/product/'.$_product-&gt;getId().'/" method="get"&gt;'."\n";
  $_attributes = $_product-&gt;getTypeInstance(true)-&gt;getConfigurableAttributesAsArray( $_product );
  echo '&lt;div class="product-attribute-options"&gt;'."\n";
  $_child_products = Mage::getModel( 'catalog/product_type_configurable' )-&gt;getUsedProducts( null, $_product );
  foreach( $_child_products as $_child_product ):
      if( $_child_product-&gt;isSaleable() ):
          $_child_product_qty = Mage::getModel('cataloginventory/stock_item')-&gt;loadByProduct( $_child_product-&gt;getId() )-&gt;getQty();
          if( $_child_product_qty &gt; 0 ):
              $_child_product_size_label = $_child_product-&gt;getResource()-&gt;getAttribute('size')-&gt;getFrontend()-&gt;getValue( $_child_product );
              $_child_product_size_val = Mage::getResourceModel('catalog/product')-&gt;getAttributeRawValue( $_child_product-&gt;getId(), 'size', Mage::app()-&gt;getStore()-&gt;getId() );
              echo '&lt;button value="'.$_child_product_size_val.'"&gt;'.$_child_product_size_label.'&lt;/button&gt;'."\n";
          endif;
      endif;
  endforeach;
  echo '&lt;input type="hidden" class="super_attribute_val" name="super_attribute[145]" value="" /&gt;'."\n";
  echo '&lt;/div&gt;'."\n";
  echo '&lt;input type="hidden" name="qty" value="1" /&gt;'."\n";
  echo '&lt;div class="add-to-cart"&gt;'."\n";
  echo '&lt;button class="button btn-cart"&gt;&lt;span&gt;'.$this-&gt;__('Buy Now').'&lt;/span&gt;&lt;/button&gt;'."\n";
  echo '&lt;/div&gt;'."\n";
  echo '&lt;/form&gt;'."\n";
  </code></pre>
  
  <p>On pressing Buy Now, it adds the product to the cart but I want to show the green success message on top as well. </p>
  
  <p><strong>EDITED</strong></p>
  
  <p>I was advised to call the following function:</p>
  
  <pre><code>function showMessage(txt, type) {
      var html = '&lt;ul class="messages"&gt;&lt;li class="'+type+'-msg"&gt;&lt;ul&gt;&lt;li&gt;' + txt + '&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;';
      $('messages').update(html);
  }
  </code></pre>
  
  <p>But considering my form, I am not sure where to call this function from. I have:</p>
  
  <pre><code>echo '&lt;button class="button btn-cart"&gt;&lt;span&gt;'.$this-&gt;__('Buy Now').'&lt;/span&gt;&lt;/button&gt;'."\n"; 
  </code></pre>
  
  <p>and on pressing the button it submits the form with action get.</p>