Connecting the functionality of php code to html pop-up |
Connecting the functionality of php code to html pop-up |
chrisj |
Dec 7 2022, 12:18 AM
Post
#1
|
Group: Members Posts: 9 Joined: 6-May 21 Member No.: 27,927 |
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 |
Dec 7 2022, 12:28 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,658 Joined: 10-August 06 Member No.: 7 |
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. 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 |
Lo-Fi Version | Time is now: 26th April 2024 - 02:26 PM |