Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5978909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:35:04+00:00 2026-05-22T21:35:04+00:00

I would like to add an option to an existing PHP page that invites

  • 0

I would like to add an option to an existing PHP page that invites users to participate in a survey – I’ve seen similar invitations appear on sites that I’ve visited in the past but have never had to build one myself. The invitation will be a hovering popup that appears on top of the current page with an option to participate which goes to a new window/page and an option to decline which simply hides the invitation. This survey will only run for one week so I can easily remove the code after 7 days but it also needs to detect if the user has previously visited this page and not dislpay the invitation again.

I assume it will use cookies to detect if they’ve seen the invitation previously and JavaScript with a DIV to display the invitation. I’m looking for any examples/code that shows how to do this in a PHP page so I can implement this on my PHP page.

Many thanks,
Steve

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:35:05+00:00Added an answer on May 22, 2026 at 9:35 pm

    The easiest way to do this would to be with JavaScript and I use jQuery to do my javascript. So you would create a div as you would want the survey to look like so:

    <div id="idOfDiv">Style this and do what you normally would</div>
    

    Then in your CSS put:

    #idOfDiv { display:none; }
    

    Finally for jQuery you can use the following snippet to get it to show:

    $("#idOfDiv").fadeIn();  
    //You can add a time in the parenthesis of fadeIn in milliseconds
    //to speed up or slow down the div loading
    

    If you want to keep track if somebody closes it and lets say you have a close button with an ID of close you can do this with jQuery.

     $('#close').click(function(){
        $.post('location/of_file/to_set/cookie.php',function(data){
            //If you want to have a confirmation message or something put this here,
            //for after the cookie gets set.
        });
        $('#idOfDiv').fadeOut();
    });
    

    and in cookie.php just have:

    <?php setcookie('noSurvey','true',time()+5000000,'/'); ?>
    

    And finally on your page where you have the div for the survey message just put:

    <?php if(!$_COOKIE['noSurvey']){ /*put div here */ } ?>
    

    That will allow you to only show the message to people who have the cookie and you can set the cookie without ever leaving the page. Also on the survey page once they’ve completed it you would probably want to set that same cookie so they don’t do it again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing toolbar and would like to add tabs to it that
I would like to add roots to a VirtualTreeView http://www.delphi-gems.com/index.php/controls/virtual-treeview with a thread like
I would like to add the BIRT reporting engine to an existing webapp in
I have own project and i would like add for this class same as
I have a ListView and each item have a TextView. I would like add
I would like to add a GestureDetector to all views (view groups) of an
I would like to add a custom calculation method to a managed object (which
I would like to add a hash into an array using Ruby version 1.8.7:
I would like to add up the number of line changes in an SVN
I would like to add a pop effect when I hover over a SVG

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.