any PHP function to popup a small window box with buttons to choose an action


jimbo45

Well-known member
Power User
VIP
Local time
5:56 AM
Posts
1,871
Location
Hafnarfjörður IS
OS
Windows XP,7,10,11 Linux Arch Linux
Hi folks
For some people this is probably easy but I'm new to this "game"

It's easy enough to get a popup window in php displaying a msg text but is there anything like having a small window with multiple choices of what to do next e.g a sort of "on action" type of thing

Simple script I'm using (and it really is simple so experienced coders please don't laugh at it) Testing examples in books are always far too complex for "Real beginners" !! --Errors and data validation can come much later !!!

Saved this as a file test3.php in the http's server in the document root so http://localhost/test3.php works properly.

<!DOCTYPE html>
<html>
<head>
<title>Embed PHP in a .html File</title>
</head>
<body>
<style>
h1 {
text-align: center;
}
</style>
<h1><?php echo "PHP Test" ?></h1>
<?php
// PHP program to pop an alert
// message box on the screen

// Function definition
function function_alert($message) {

// Display the alert box
echo "<script>alert('$message');</script>";
}


// Function call
function_alert("This is a test for Popup box");

?>
<h1>Test Succeeded PHP installed properly</h1>
<p style="font-weight: bold; text-align: center;">Exiting Rc=0</p>

</body>
</html


when running from local web server (I'm using apache but it's probably similar in IIS.

http://localhost/test3.php shows the following

Screenshot_20220414_135135.png


When the OK button is clicked the rest of the script executes

Screenshot_20220414_135220.png
What I want is something like choice a, choice b choice c - then user input and then continue depending o the user input chice.

thanks all

Cheers
jimbo
 

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7
Top Bottom