I want to get the value of one text box if a particular button is clicked. I can't send the value through url so I tried using javascript. Here is my php code:
<a href="yahoo/Connected.php">
<input type='button' class='button' id='yahoo' value='Yahoo'></a>
<p>Your name, emails will be sent with your name in Subject</p>
<input type='text' class='inviteename' id='text' name='name'>
Here is my javascript code:
<script>
$('#yahoo').live('click',function() {
var inviteename = $('.inviteename').val();
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/; domain=.example.com";
}
createCookie('invitee_name',+inviteename,'1');
});
</script>
Through this, cookie is not being create, can anyone spot what wrong I'm doing?