Help - Search - Members - Calendar
Full Version: Connecting the functionality of php code to html pop-up
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
chrisj
This code is in the php file:

CODE
if (empty($error) && $_POST['set_p_v'] == 0){
    echo '<script type="text/javascript">alert("myPopup")</script>';
}


how do I connect that to a separate html file, that has this:


CODE
function myFunction() {
  var popup = document.getElementById("myPopup");
  popup.classList.toggle("show");
}


and this:

CODE
<span class="popuptext" id="myPopup">


and where does the pop-up message/text go?

I look forward guidance/assistance
Christian J
QUOTE(chrisj @ Dec 7 2022, 06:18 AM) *

This code is in the php file:

CODE
if (empty($error) && $_POST['set_p_v'] == 0){
    echo '<script type="text/javascript">alert("myPopup")</script>';
}


That PHP script should create a javascript alertbox with the message text "myPopup" (provided the PHP script's IF conditions are true).

QUOTE
how do I connect that to a separate html file

What does "connect" mean here? I guess you could put the above PHP code in the HTML file. unsure.gif

But note that the javascript alertbox above has nothing to do with the SPAN element with the ID "popup", and neither is a javascript popup window --the latter are made like this: https://htmlhelp.com/faq/html/links.html#window-specify
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.