Results 1 to 8 of 8

Thread: [RESOLVED] Setting Cookie

  1. #1

    Thread Starter
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Resolved [RESOLVED] Setting Cookie

    I have the following code located at the top of my page:

    PHP Code:
    //Checks if the forum was submited...
    if ($_POST['email'] == "" && $_POST['password'] =="") {
            
    //if it was not, check to see if cookies exist...
        
    if (isset($_COOKIE['email']) && isset($_COOKIE['password'])) {
            
    //if so, set in a var and put in a textbox
                    
    $mememail $_COOKIE['email'];
            
    $mempassword $_COOKIE['password'];
        } else {
                    if 
    their not setmake vars to nothing
            $mememail 
    "";
            
    $mempassword "";
        }
    } else {
            
    //form was submited, set cookies if checked
        
    if ($_POST['remeber']=="checked") {
            
    setcookie("email"$_POST['email']);
            
    setcookie("password"$_POST['password']);
        }

    and it doesnt work. . There are no error, it just doesnt call the cookie. I dont think it is set right.
    My usual boring signature: Something

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Setting Cookie

    If you set error_reporting(E_ALL) then you will find out why your code doesn't work .
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Setting Cookie

    i dont have access to my php.ini file though.
    My usual boring signature: Something

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Setting Cookie

    error_reporting is a function. Call it at the top of your script:

    PHP Code:
    <?php
      error_reporting
    (E_ALL E_STRICT);

      
    // rest of code
    ?>
    And then fix any notices/warnings/errors that are produced. You should do this for all scripts.

  5. #5
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Setting Cookie

    Do the cookies (munch, munch, yum, yum ) actually exist?

    If you're using IE7 (or plugin for IE6) or FF you can view all the current cookies saved which is a good way to check

  6. #6

    Thread Starter
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: [RESOLVED] Setting Cookie

    i think i figured it out. Thanks guys
    My usual boring signature: Something

  7. #7
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: [RESOLVED] Setting Cookie

    DClamp can you tell us what went wrong?

    Would be useful to know for future searches


    ILMV

  8. #8

    Thread Starter
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: [RESOLVED] Setting Cookie

    quite frankly, i have no idea. I would love to tell you but i dont know
    My usual boring signature: Something

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width