php - How to get a cookie value for input field? -
I have a form and I have set cookies in the input field. When I visit the The same form appears in all pages when I redirect from one page to another, the form field that I have selected should appear in all the pages. I used the code below to get the cookie value But I'm getting the error because Can someone indicate that this error What will be the reason? And how do I get the cookie values in the input field? Generally, you should set this how to cook cookies in Google, not sure that you have the function Do something like getCookie declare? And here it is Check this one for more information Hope Is that it can help :) element , you can find cookies in
& lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {if (input1 = getCookie ("input1")) document.myform.input1 .value = input1;}); & Lt; / Script & gt;
is unwanted reference reference: getCookie is not defined
& lt; Script type = "text / javascript" & gt; Function set cookie (key, value) {var ends = new date (); Expires.setTime (expires.getTime () + (1 * 24 * 60 * 60 * 1000)); Document.cookie = key + '=' + value + '; Ends = '+ expires.toUTCString (); } Getcookie function {var keyValue = document.cookie.match ('(= | |)?' + Key + '= ([^;] *) (| | $)'); Return Key Key Properties [2]: Zero; } $ (Document) .ready (function () {set cookie ("input 1", '1'); alerts (getCookie ("input 1"); document.myform.input1.value = getCookie ("input 1") ;}); & Lt; / Script & gt;
Comments
Post a Comment