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 9159901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:36:22+00:00 2026-06-17T13:36:22+00:00

Its very simple but i don’t see the solution. How can I put a

  • 0

Its very simple but i don’t see the solution.

How can I put a php var in this twitter bootstrap popup link?

<a href="#myModal" title="Lees meer" value="12345" data-toggle="modal">Read More</a>

And how can i get and print the value of this link in the popup field?

  • 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-06-17T13:36:23+00:00Added an answer on June 17, 2026 at 1:36 pm

    If short tags are enabled:

    <a 
        href="#myModal" 
        title="Lees meer" 
        value="12345" 
        data-toggle="modal" 
        data-phpvar="<?=$myVariable?>"
    >
        Read More
    </a>
    

    else:

    <a 
        href="#myModal" 
        title="Lees meer" 
        value="12345" 
        data-toggle="modal" 
        data-phpvar="<?php echo $myVariable; ?>"
    >
        Read More
    </a>
    

    both indented for readability – don’t do this in actual HTML, it looks messy.

    And to get it in jQuery – .data("variable") automatically gets attributes that start with data-:

    $("a[href=#myModal]").click(function() {
        alert($(this).data("phpvar"));
    });
    

    or use the .attr equivalent:

    $("a[href=#myModal]").click(function() {
        alert($(this).attr("data-phpvar"));
    });
    

    and to output in the modal:

    $("a[href=#myModal]").click(function() {
        var phpVariable = $(this).attr("data-phpvar");
        var modalObject = $($(this).attr("href"));
        modalObject.find(".modal-body").text(phpVariable); //You might also use .html()
    });
    

    JSFiddle demo of the code working

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

Sidebar

Related Questions

My problem is very simple but I don't really know its name and therefore,
This should be very simple, but its not working! I have this link on
This is probably very simple but it's really confusing me. When I implement the
This is a homework task, but it's very simple. The task comes with a
I feel as if this should be very simple, but it's behaving strangely. I
I'm having a little problem which looks very simple... but I just don't get
This is a very simple question but All is such a bad keyword to
I'm sure there has to be a very simple solution to my problem but
This is most def something very simple, but it is driving me crazy, cant
Apologies if this is a very simple question; I don't use XSLT very much

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.