开发者

How to create a cookie on form submitting?

i have a light box form i want to create a cookie when user submitting that form...my cookie variables are 开发者_运维百科 setCookie("username",username,1000) i want to do this while user submitting the form...thanks..!

Your Full Name:

<p>Your Facebook Email Or Username: 
  <input type="text" name="email" value="" maxlength="60" size="60">
</p>


When lightbox is opened...

$('.lightbox').click( function() {

    $.post('save_cookie.php');

});

And save_cookie.php:

setcookie(...);

I did it with PHP because your only tag is php. You can do it with only javascript too.

P.S. I used jQuery here too.


When you are submitting a form and redirecting it to your main page, at the top of that you can write code to set cookie ..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜