...

View Full Version : How can I do this:



sciguyryan
03-11-2004, 05:47 PM
Ok, I will be using this for a shoutboX:



<?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?

SDP2006
03-11-2004, 06:12 PM
Basically, you can just echo it into the text field i.e.


<?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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum