Jump to content

[SOLVED] how do i set php session from javascript?


sayedsohail

Recommended Posts

Lets see your problem here correct me if I am wrong. You have a javascript variable that you wish to use as a php variable is this right? Maybe you can give me more detail concerning your problem and what it is that you are trying to accomplish because it seems you have a interesting problem one of my favs probably. If a process needs to be done over more then one page then I would use cookies (a shopping cart for example). But if all your actions need to be done(or it would be nice to handle within one page) then I would avoid cookies and use ajax instead which improve user usability

lets make it simple here is the code

 

 


<html>
<head>
<script type="text/javascript">
//decalre timer null
var timer=null;

function delaytimer(b)
{
window.clearTimeout(timer);
timer=window.setTimeout(getValue(b),5000);
}

function getValue(a)
{

var x=document.getElementById("a").value.length;
alert(x)
}
</script>
</head>
<body>

<input type='text'  id="myHeader" onkeyup="delaytimer('myHeader')">
<p>Type a letter to alert</p>

</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.