/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<?
// the 2 post items that we need for tax.
$zip = $_POST['Ship-Zip'];
$total = $_POST['Taxable-Total'];
// connect to your mysql db, with yahoo your localhost is mysql
$result = mysql_query("SELECT * FROM `zip_codes` WHERE `zipcode` LIKE CONVERT( _utf8 '$zip' USING latin1 )")
// this checks if a zip code is returned, if no then no tax is charged
if($num_rows != "0"){
$percent = $row['taxrate'];
}
$to = ($percent/100)*$total;
}else {
$to = "0";
}
//needs the 200 ok header for the cart to see it.
?>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                