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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.