SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    How to pass value from the footer a popup form in the header

    Hi guys,

    I've a little problem need to solve.

    I've a log in form in the header.php. It activates when the user click on a link within a page.
    However, I want to pass a variable e.g. $this_item from the footer to that form. Here's my code:
    Code:
    echo "<a href='#?this_item=" . $this_item . "' class='log_in_form'>Log In</a>";
    How do get it work? (In this case the page does not reload)

    Thanks

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,191
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    You could use a hidden form in the footer that simply contains a hidden input field with the value then use the form popup to see out the value using JavaScript.

    Code HTML4Strict:
    <form action="" method="post" onsubmit="return false;">
        <input type="hidden" name="footer_value" id="footer_value" value="<?php echo $this_item; ?>" />
    </form>

    Code JavaScript:
    alert(document.getElementById('footer_value').value);

  3. #3
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    It's not working, or maybe I just don't know how to get it worked.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •