I want to display form conditionally on each page of my website. If user has filed form once cookie will be set. Next time if user visit the website then this block will hide according to set cookie and a image will be displyed.

Can anyone guide me with this.

Thanks in Advance.

Comments

fidot’s picture

Presumably, submiting the form already writes something to a table T for the specified user.

I would define 2 blocks, one containing the form and one containing the image. Within the block visibility settings, use PHP to determine which to show.

The PHP code would check existence of a row within table T for the specified user. So, if row exists, "image" block visibility = yes. If row does not exist, "form" block visibility = yes.

HTH
Terry

AP-dupe’s picture

Thank you for quick reply ....I got some better results now.....In block I am using logic..if cookie set then display image otherwise form....when I fill this form and refresh or reload page, form is not showing..which is desired result....but second time refresh is showing form...i checked expiry of cookie, its 24 hours....