liverpool-phil Posted July 31, 2019 Share Posted July 31, 2019 HI, Is there a way I can pass a variable (or contents thereof) to a modal when it is called, perhaps as part of the onclick? I was looking at the w3.CSS example below: So that, for instance I could do something like... <p>This <?PHP echo $name; ?> has registered on $site </p> Apologies if this is the wrong forum, but I'm using W3.CSS and this example is similar to what I am trying to achieve. My final modal will have a construct similar to: <container> <header> <table> <footer> Each will section will have some variables in... Thanks Phil <!-- Trigger/Open the Modal --> <button onclick="document.getElementById('id01').style.display='block'" class="w3-button">Open Modal</button> <!-- The Modal --> <div id="id01" class="w3-modal"> <div class="w3-modal-content"> <div class="w3-container"> <span onclick="document.getElementById('id01').style.display='none'" class="w3-button w3-display-topright">×</span> <p>Some text in the Modal..</p> <p>Some text in the Modal..</p> </div> </div> </div> Link to comment Share on other sites More sharing options...
dsonesuk Posted August 1, 2019 Share Posted August 1, 2019 You would need a php page that will provide those details then use ajax to go to that page with querystring that would provide a key on what to return and then return the content it produced on any javascript event you choose. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now