Forum Moderators: coopster

Message Too Old, No Replies

using a cookie to disable part of a page

         

surrealillusions

12:38 pm on Jan 30, 2008 (gmt 0)

10+ Year Member



Is this possible?

If a contact form has been filled out, then a cookie is set for a certain length of time that disables the submit button on the form, or gets rid of it completely with another message there.

Obviously if the cookie has expired or doesn't exist, then the page displays as normal?

How would i go about this? I've only just this past few minutes looked into cookies while looking at logon pages, and just had this idea. So i'm clueless about it all..any good pointers or tutorials out there to get me started?

:)

omoutop

12:49 pm on Jan 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



in theory it can be done - never tried it though

lets see...

setcookie('cookie_name', $somevalue, $time+180, '/', 'www.example.com');

the above cookie is valid/active for 180 sec = 3 mins

in your form:
if (!isset($_COOKIE['cookie']))
{
// show submit button
}
else
{
// show some message
}

I think something like this could work