#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    33
    Rep Power
    15
    i use a simple form to test,
    i can set a cookie once,
    but when i change the selected button to
    another value, the cookie isn't changed

    also the question, how do i retrieve the cookie so that the next time the rigth option
    is selected ??
    i'm using windows 98 and IE5.0 maybe there it goes wrong ??

    well here is my simple code :
    <?
    if (isset($submit)){
    setcookie("radio",$radio,time()+31536000); //set the cookie expiry date
    }
    ?>
    <HTML>
    <HEAD>
    </HEAD>
    <BODY>

    <form action="<? print $PHP_SELF ?>" method="post">
    Sex : male<input type="radio" name="radio" value="male")<br>
    female <input type="radio" name="radio" value="Female") <br>
    </form>
    <input type="submit" name="submit" value="submit">
    <?
    print $radio;
    ?>
    </BODY>
    </HTML>

    i can't understand why the cookie not changes

    thanks for your help, i really appreciate
    this forum !

    Jan. The Netherlands


  2. #2
  3. No Profile Picture
    PHP Programmer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    31
    Rep Power
    15
    to begin with, you must have <input type="submit" name="submit" value="submit">
    BEFORE </form>.

    If this does not help (i think it will), print the value of $radio to see if it gets the right value.

Similar Threads

  1. Placing user-entered data into cookie
    By Tyrone in forum Perl Programming
    Replies: 2
    Last Post: February 17th, 2004, 04:31 PM
  2. re: Cookie - serves only one directory?
    By ellen in forum PHP Development
    Replies: 1
    Last Post: February 16th, 2004, 11:59 PM
  3. cookie greeting on all pages from multiple form entries
    By diplod in forum HTML Programming
    Replies: 0
    Last Post: February 11th, 2004, 12:33 AM
  4. Replies: 1
    Last Post: February 10th, 2004, 09:14 PM
  5. will PHP write over the same cookie?
    By xpatriot in forum PHP Development
    Replies: 5
    Last Post: February 2nd, 2004, 08:59 AM

IMN logo majestic logo threadwatch logo seochat tools logo