www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] Modalbox popup with php variables sent in URL

  1. #1
    Join Date
    Aug 2004
    Location
    Switzerland
    Posts
    1,101

    resolved [RESOLVED] Modalbox popup with php variables sent in URL

    Hi people !
    I'm trying to do a popup using modalbox (http://www.wildbit.com/labs/modalbox/). The point is having a nice AJAX popup with some cool effects, rather than a simple JS popup.
    The popup opens when the user clicks on a link, and it returns a page which will display some text according to the parameters sent in the url.

    My url looks like something like this :
    page.php?id=1

    Then, the page.php is something like that :
    PHP Code:
    $getid $_GET['id'];

    $auteurname mysql_result(mysql_query("SELECT auteur FROM bioauteurs WHERE ID='$getid'",$connection),0);
    $auteurbio mysql_result(mysql_query("SELECT bio FROM bioauteurs WHERE ID='$getid'",$connection),0);

    echo 
    "<h2 class=\"auteur\">".$auteurname."</h2>";
    echo 
    "<p class=\"biographie\">".$auteurbio."</p>"
    My main problem is that my modalbox doesn't work at all. It opens, doesn't display any content, and content is then opened in another page.

    Why is it so ? Is it not possible to pass php parameters in AJAX using a simple method ?

    Here is what I did :

    HTML Code:
    <a href="page.php?id=1" title="Simple form" onclick="
    Modalbox.show(this.href, {title: this.title, width: 600}); return false;
    "> Test page</a>
    I attached the modalbox scripts, if somebody wants to take a look.

    Any help would be great. I've been working on this for two days, trying to find info on the net, and I couldn't grab anything that would work
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2008
    Location
    Olean, NY
    Posts
    40
    You may need to stop the event from propagating. Try not to use the inline onclick and instead bind the click function from a script block (appearing lower on the page so that you know the link in question has loaded by then)

    try this:

    myLink.click = function(e){
    e = window.event ? window.event : e;
    e.preventDefault();
    // now do your other stuff.

    };

    This should hopefully stop the browser from activating the link. If it still doesn't work, investigate your modal library more, it may have issues or a special way to do what you want.

  3. #3
    Join Date
    Aug 2004
    Location
    Switzerland
    Posts
    1,101
    Yeah, but the link should be activated. The problem is that the parameters are not taken into account when the link is sent...

  4. #4
    Join Date
    Aug 2004
    Location
    Switzerland
    Posts
    1,101
    Actually, a chain of problems was preventing this to work, but it finally worked the way I did it first.
    The problem was with the scriptaculous file, as well as with the page's doctype (no idea why).

  5. #5
    Join Date
    May 2011
    Posts
    1
    how did you solve it please?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles