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 element , you can find cookies in resources This code is confidential, so I can not show how I set my cookies. But I'm sure I have selected input fields in resources- & gt; Cookies may be found.

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

  & lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {if (input1 = getCookie ("input1")) document.myform.input1 .value = input1;}); & Lt; / Script & gt;   

But I'm getting the error because is unwanted reference reference: getCookie is not defined

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?

  & 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;      

And here it is

Check this one for more information

Hope Is that it can help :)

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -