Just a quick question. I have a form that calculates values based on user entry. The information is then passed via ajax to a php file for calculation returning the results. The problem is that that PHP file needs to reference the header as it needs to use the get_posts function to receive the string and collapse it into an array. Problem is that that bulks up the file massively and courses functions to execute in the header that we do not want as then the whole damn header arses up the ajax load and we get a blank screen.
So is there a way or a place to put this file whereby it can get_posts without having the bulky header load as well. Bit of code here if you are interested.
<?php
if (is_page('main-functions')) {
$str = dataSting;
(explode(",",$str));
$totalprice_posts = get_posts('post_type=services&numberposts=-1');
$totalprice_array = array();
foreach ($totalprice_posts as $post) {
$productprice = $_POST['price'.$post->ID];
$productprice = $_POST['quant'.$post->ID];
$totalproductprice = ($productprice * $productquantity);
array_push($totalprice_array, $totalproductprice);
}
implode(',', $totalprice_array);
$totalprice = array_sum($totalprice_array);
echo $totalprice;
;}
?>
Any ideas,
Marvellous.