Forum Moderators: coopster
session_start();
if (!isset($_SESSION['caddy']))
{
$_SESSION['caddy'] = array();
}
if (isset($_REQUEST['id']))
{
if ($_SESSION['caddy'][$_REQUEST['id']])---line41
{
$_SESSION['caddy'][$_REQUEST['id']]++;
}
else
{
$_SESSION['caddy'][$_REQUEST['id']]=1;
}
}
if (count($_SESSION['caddy'])==0)
{
echo "<p>Caddy Empty!</p>";
}
----------------------------------------------------
when i'm using this piece of code i'm getting this error:
Notice: Undefined index: 7 in c:\program files\easyphp1-7\www\caddy\gerer_caddy.php on line 41
I d'nt understand..i've passed the 'id' to this script! or is it 'caddy' that is undefined..
A+
1)How to put two words on the same line but one to the xtreme right and the other to the xtreme left
I have this:
echo "<html>";
echo "<head><title>Librairie</title></head>";
echo "<body>";
echo "<h1>Welcome..</h1>";
echo "<p align='right'>";
echo "[ <a href=\"login.php?&log='out'\" align='right'>Log Out</a> ] ";
echo "</p>";
echo "<hr>";
I want 'Log Out' to appear to the xtreme right of 'Welcome'
----------------------------------------------------------
2)Every time I click on the refresh button, the quantity of items in my shopping cart is incremented..How to avoid this?(look at my 1st post for the code)
thx..
darn jobs always get in the way ;)
1) use a table or a div and align them to the two sides
2) protecting against refresh problems is always interesting. I can tell you why it is doing it
if ($_SESSION['caddy'][$_REQUEST['id']])
{
$_SESSION['caddy'][$_REQUEST['id']]++;
}
that says if $_SESSION['caddy'][$_REQUEST['id']] is already set then increment it by 1
to protect against this there needs to be some scenario to check.
if ('form already submitted') do nothing
maybe if you give us a little more logic we might be able to help out more.
there must be a way to know whether the script is being executed for the 2nd time with the same session_id.Or simply disabled the refresh button.
I dn't know much about php.I think its high time for me to buy a book!
Thx again.