cookie, post method form, cycling background

From: Date: Sat, 29 Apr 2000 01:21:16 +0000
Subject: cookie, post method form, cycling background
Groups: php.version4 
Request: Send a blank email to php-version4+get-14159@lists.php.net to get a copy of this message
This is my first attempt with cookies, I've run into a prob, and unfortunatelly, it's 3 AM here. Just can't see it. Apache / 4b RC2-dev on NT, MSIE5.0 & CC4.7 on NT goal: 5 backgrounds. User clicks the submit button, next backbround is displayed, and its number is stored in a cookie. 1 -> 2 -> 3 -> 4 -> 5 -> 1 -> 2 ... The prob: display the page, submit the form... nothing happens. (1) submit again, get the next background... ok. go someplace else, then back to the page (or reload the page), get the next background. (2) submit the form, nothing happens, submit again, get the next background. Why do those two things happen? <? if ( ! isset( $HTTP_COOKIE_VARS['divcookie'] ) ) { $div = 1 ; } else { $div = $HTTP_COOKIE_VARS['divcookie'] ; } ; if ( 1 == $submitted ) { ( 5 == $div ) ? $setdiv = 1 : $setdiv = $div + 1 ; setcookie( 'divcookie' , $setdiv , time() + 100000000 , '/e2/div/' , 'cynic.bewotec.cz' , 0 ) ; } ; ?> +HTML> +HEAD> +/HEAD> +BODY BACKGROUND="/e2/images/div<?= $div ?>.gif" BGCOLOR="#800000"> <? echo $HTTP_COOKIE_VARS['divcookie'] ; ?> +TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" COLS="1" HEIGHT="100%"> +TR VALIGN="BOTTOM"> +TD VALIGN="BOTTOM"> +FORM ACTION="<?= $REQUEST_URI ?>" METHOD="post"> +INPUT TYPE="hidden" NAME="submitted" VALUE="1"> +INPUT TYPE="Image" SRC="/e2/images/div.gif"> +/FORM> +/TD> +/TR> +/TABLE> +/BODY> +/HTML> Btw, sorry for the strange HTML tags, but I can't get my Eudora send mail in a reasonable way. ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz ICQ: 2808 2505

« previous php.version4 (#14159) next »