Hiya peeps,
Ok here is the codes.
order.php
Code:
<?php
if(!isset($_POST) OR empty($_POST)) {
echo '<h1 align="center">There was an error with your order!</h1><h2 align="center"><a href="index.php">Start again</a></h2>';
} else {
$tesco = new Tesco();
foreach($_POST as $key => $value) {
$tesco->getPrice($value, $key);
}
echo '<h1><u>You ordered:</u></h1>';
echo '<h2>'.$cnt[$row['id']].' x '.$row['name'].'</h2>';
echo '<h1><u>Results</u></h1>';
echo '<h2>Cheapest at: ' . $store . '</h2>';
echo '<h2>Amount: £'.$total.'</h2>';
if($total > 50) {
echo '<a href="" onclick="" class="buttonn">Deliver it!</a>';
} elseif ($total < 50) {
echo '<a href="" onclick="" class="buttonn">Deliver it for £9.99!</a>';
}
}
?>
tesco.php
Code: <?php
class Tesco {
private $quantity;
private $productid;
function getPrice($quantity, $productid, $storeid = '1') {
$this->quantity = mysql_real_escape_string(trim(addslashes(strip_tags(is_numeric($quantity)))));
$this->productid = mysql_real_escape_string(trim(addslashes(strip_tags(is_numeric($productid)))));
$this->storeid = mysql_real_escape_string(trim(addslashes(strip_tags(is_numeric($storeid)))));
$this->query = "SELECT * FROM `products` WHERE id = '$this->productid' AND store = '$this->storeid'";
$this->result = mysql_query($this->query) or trigger_error('Query failed: ' . mysql_error(), E_USER_ERROR);
while($this->price = mysql_fetch_object($this->result)):
if($this->quantity > 1):
$this->total[] = $this->price->price*$this->quantity;
elseif ($this->quantity = 1):
$this->total[] = $this->price->price;
endif;
endwhile;
print_r($this->total);
}
}
?>
As you can see in the tesco.php file i have a print_r() this is what is being returned..
Array ( => ) Array ( => [1] => )
(i have inputed two product id's).
Many thanks
$_POST
Hi, I have 2 seperate php files, and i want my $_POSt["fname"] To go into both of them, For Example:Goto: http://ucp.south-westrp.com/UCP.phpType Username: Comptons_Eazy_EAnd Password:
Help with PHP Email Script
Hi guys,I'm a newbie to php and need help with the script below:At the moment when I receive the automated email of data, I'm not receiving any information with the form field names I receive blank
trouble printing an array....
I'm having some trouble printing out an array forwards. I'm figuring out the high and low of an array and did soo, but can't print out. My result is zero. if anyone could help that would be great, and
Run function every 5 mins ??
I have a function PostMessage()How can I run it every 5 mins ??
How could I do this?
Ive got a simple lottery game, and am using an sql database to keep track of the numbers bought. But, when the person comes to buy the ticket, I have to replay to my process page which ticket they
Line break?
Hi, I'm new to the forum and new to php. I'm not sure if I'm using the correct terminology so here it goes. I've created a page with multiple forms that when submitted get emailed to a certain
Batch update record with Pagination
Hoping someone can help me with this issue I'm having, im trying to batch update records from a result set with pagination. The first page results (first 10 records) will update with the batch, but
Do not allow posting of whitespace
Currently the script below works if the user does not type a name/message, but if i create a whitespace with the spacebar, it will submit. How would I fix this?message page:<?php// Get the
PHP Upload issue
Hi guys,I have stumble across an interesting issue with my script and is doing my head in.A little background on the application.I've got a document repository site which uses Jupload to upload
need help in creating captcha
hi i have a problem creating captcha system. i create some basic script for image displaying but it says this errorCode: The image “http://localhost/examples/captcha.php†cannot be