Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2003
    Location
    Rhondda Cynon Taff, Wales
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How can I do this:

    Ok, I will be using this for a shoutboX:

    PHP Code:
    <?php
    if (isset($_COOKIE['CookieName'])) {
      
    // If "CookieName" is set, do this!!!
    } else {
      
    // If "CookieName" is NOT set, do this!!!
    }
    ?>
    Now, I want to read the username from the cookie and put it into a text field. How can I do this?
    Ryan Jones(sciguyryan)
    Visit us and chat at our forums - the Kidscript Forums

  • #2
    Regular Coder
    Join Date
    May 2003
    Location
    34 54' N 82 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Basically, you can just echo it into the text field i.e.
    PHP Code:
    <?php
    if(isset($_COOKIE['CookieName'])){
        echo 
    '<form action="form.php" method="POST" id="f1">';
        echo 
    '<input type="text" value="'.$_COOKIE['CookieName'].'" id="name" />';
        
    /* Rest of form, etc. etc. */
       
    echo '</form>';
    }
    else { 
    do_whatever_you want(); }
    ?>
    Hope this helps.
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!


  •  

    Posting Permissions

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