Problem in doing popup box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • janna48
    New Member
    • Jul 2007
    • 11

    #1

    Problem in doing popup box

    Hi,
    I am very new to AJAX because i never learned AJAX back in university but i wanted to do this popup box that will appear two months before the expiry date(this expiry date has to be retrieved from the database because i've made a form which i have to fill in with all the customer's details including their contract's expiry date) which is just like a notification. So, the thing is, i know a lil bit of javascript but i know that javascript can not interact with database, so i tried to do all the date calculation in php and then i included it in javascript, but i failed because the popup itself that has to be appeared 2 months before the expiry date. So i really really need your help.thank u so much
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You should not even need AJAX. You can just use PHP to generate the code that displays the popup. When the user logs in, it checks the expiry date. If the date is right, it displays a popup.

    Comment

    • janna48
      New Member
      • Jul 2007
      • 11

      #3
      Originally posted by acoder
      You should not even need AJAX. You can just use PHP to generate the code that displays the popup. When the user logs in, it checks the expiry date. If the date is right, it displays a popup.
      Ahh, i actually understand that, but the thing is, i don't how to start it. can u prolly show me one example?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        So, are you having a problem with PHP dates or showing a popup box? Also remember that you will need to check for within 2 months because the user might not visit the page exactly 2 months before.

        Comment

        • janna48
          New Member
          • Jul 2007
          • 11

          #5
          I don't know how to do both the date calculation and the popup in php. i only know this javascript for popup:

          <SCRIPT language="javas cript">
          alert('Hello');
          </SCRIPT>

          Im such a loser eh?

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            An alert should probably be fine for your purposes. I suggest you start a new thread in the PHP forum for your date calculation problem. Post your code (what attempt you've made so far) so that the experts there can help you.

            Once you've solved that problem, you can have something like:
            [PHP]<?php if (expiry2mthsb4) { ?>
            <script type="text/javascript">
            alert('There are two months left to your expiry date...blah blah.');
            </script>
            <?php } ?>[/PHP] Note the use of type rather than language=. The language attribute is deprecated and should no longer be used.

            Comment

            • janna48
              New Member
              • Jul 2007
              • 11

              #7
              will do that. thank you so much for helping

              Comment

              Working...