开发者

How to create a cookie on form submitting?

开发者 https://www.devze.com 2023-03-18 02:22 出处:网络
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

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

精彩评论

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