Page 1 of 1

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

Posted: Tue Jun 13, 2006 7:54 am
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.

Posted: Tue Jun 13, 2006 8:08 am
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>

Posted: Tue Jun 13, 2006 9:33 am
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.

Posted: Tue Jun 13, 2006 9:54 am
by g99ma
Thanks guys I will try that