how can i create a dialog box in php with javascipt disabled

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
g99ma
Forum Newbie
Posts: 2
Joined: Tue Jun 13, 2006 7:31 am

how can i create a dialog box in php with javascipt disabled

Post by g99ma »

Hi all,

This is my first post ... so please forgive me if I'm asking this all wrong.

I am a work term student who just got introduced to coding with PHP. I am presently working on developing a basic electronic filing project.
On some of my webpages I have a "quit button" which when clicked on by the user should bring up a dialog box confirming that the user wants to quit that page. I know how to do this using Javascripts however my supervisor says to find a way to not use javascript because it is not supported by all browsers and some users disable it.
My question: Is it possible to create a dialog/alert box with just php codes? Or is it possible to still go ahead and use the Javascript while taking care of the above mentioned problems.

Thanks for your anticipated help.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

You can combine PHP and Javascript if you want, but using Javascript would be better. One thing with the Javascrip is that you can make the button print ONLY if the user has Javascript enabled by doing this:

Code: Select all

<script type="text/javascript">
document.write('<input type="button" value="Close Window" onclick="the javascript code's function();">')
</script>
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Just make your quit button a link to a form that asks if they're sure. "Yes" makes the user quit as the "quit" button normally would, "No" takes the user back to what they were doing.
g99ma
Forum Newbie
Posts: 2
Joined: Tue Jun 13, 2006 7:31 am

Post by g99ma »

Thanks guys I will try that
Post Reply