I am having a bit of a fit. (about 2 days worth) Perhaps someone can help.
I have a function which determines the shipping costs for a range of weights. (shortened here for clarity)
<?php
function calculate_shipping_cost($total_price, $total_weight, $ship_method)
{
if ($total_price >= 1000)
{
$shipping = "0.00";
{ return $shipping; }
}
//calculate ups ground charges
if ($total_weight >=0 && $total_weight <=9 && $ship_method == "ups_ground")
{
$shipping = "7.50";
{ return $shipping; }
}
}
<?
I have set session_register('shipping'); earlier on and have track_vars enabled on the server. I even turned the server globals to on, just to see if it would help.
The function works fine... that is, until I attempt to insert $shipping in the shipping table via a query in a different file, via the following script.
<?php
//insert shipping and tax information
$query = "insert into shipping_and_taxes values
('$orderid', '$shipping', '$ship_method', '$tax', '$non_prof_cert')";
$result = mysql_query($query);
if(!$result)
return false;
<?
$orderid (which is related to the primary key) is inserted into the table fine.
$ship_method and '$non_prof_cert which were submitted via a form earlier on insert fine too.
$tax is a future addition so is null right now.
$shipping, which was the value returned above... just disappears into the netherworld and I just can't seem to be able to retrieve it to put it in the table... or use it anywhere other than the page where the calculate_shipping_cost was called from.
Has to be something I am missing. Yup... I have been to the manual and to my understanding...(which is limited) think I have done what I was supposed to do. I am enjoying the challenge, but could use a little boost here.