use below code to add product to cart
$cart = Mage::getSingleton('checkout/cart');
$cart->init();
$qty=1;
$productId='10'; //product id
$product = Mage::getModel('catalog/product')->load($productId);
$formKey = Mage::getSingleton('core/session')->getFormKey();
if($product->getSku()!='')
{
$paramater = array(
'product' => $productId,
'qty' => $qty,
'form_key' => $formKey
);
$cart->addProduct($product, $paramater);
$cart->save();
}
else
{
Mage::log('product not vailable');
}
$cart->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);