Hi,
I have written the script below and it works fine on my local server running PHP 4.3.10. I upload it to my webserver and I get the error below. The webserver is running the same (!) php version.
error:
Warning: array_splice(): The first argument should be an array in /home/twisted/www/shop/delitem.php on line 11
Warning: array_splice(): The first argument should be an array in /home/twisted/www/shop/delitem.php on line 12
line 11 and 12 are the second and third line with array_splice.
I think it has to do with some setting on my webserver but I have no clue. Can anyone hint me into the right direction??
<?php
session_start();
// delete line in cart
$delItem = $_GET['itemno'];
$prize = $_SESSION['prize'][$delItem];
$slice = $_GET['itemno']+1;
$achterkant = -count($_SESSION['item'])+$slice;
array_splice ($_SESSION['item'], ($slice-1),$achterkant);
array_splice ($_SESSION['name'], ($slice-1),$achterkant);
array_splice ($_SESSION['prize'], ($slice-1),$achterkant);
//subscract from total prize
$_SESSION['total'] = ($_SESSION['total']-$prize);
// one less item in cart
$_SESSION['itemNo']--;
header ('Location: ../templates/shop.php');