PHPilliterate Posted January 13, 2008 Share Posted January 13, 2008 Howdy! I have a login page that uses a dynamic dropdown list to select the username, the have a cookie created that uses the USERNAME field for the cookie variable. When a user submits the login, it then takes them to a SEARCH page. I need to know how (or if possible) to have the cookie pre-set the search field with the same name as as the USERNAME field from thje login page. Here is my code from the login page that creates the cookie: <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { setcookie("logIn", "".((isset($_POST["username"]))?$_POST["username"]:"") ."", time()+(60*60*24*0), "/", "", 0); } ?> And this is the code for the SEARCH field from the search page: <td class="DataTableCell"><input name="S_team" type="text" class="WADADataTableCell" id="S_team" value="<?php echo $_COOKIE['logIn']; ?>" /></td> Is there a way to make this work? Quote Link to comment https://forums.phpfreaks.com/topic/85770-use-cookies-to-input-search-text/ Share on other sites More sharing options...
sKunKbad Posted January 13, 2008 Share Posted January 13, 2008 Why use a cookie, why not use the posted name directly? Or if you need the cookie set, do both. Quote Link to comment https://forums.phpfreaks.com/topic/85770-use-cookies-to-input-search-text/#findComment-437776 Share on other sites More sharing options...
PHPilliterate Posted January 14, 2008 Author Share Posted January 14, 2008 Why use a cookie, why not use the posted name directly? Or if you need the cookie set, do both. Thanks for the idea. How would I use the 'username" to be included on the next page in the search field? ??? (Reading php script is like reading hiroglyphics) Quote Link to comment https://forums.phpfreaks.com/topic/85770-use-cookies-to-input-search-text/#findComment-438431 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.