pratik_learner
07-13-2005, 11:39 AM
I want to know how to ( if possible) use PHP to display alert, confirm, message boxes like in JavaScript.
|
Click to See Complete Forum and Search --> : How to use features of JavaScript with PHP pratik_learner 07-13-2005, 11:39 AM I want to know how to ( if possible) use PHP to display alert, confirm, message boxes like in JavaScript. A1ien51 07-13-2005, 11:54 AM You can have the php write to the code to the page, but you can not have the user put in input and expect the server side code to use it as it is firing inline. Eric NogDog 07-13-2005, 02:58 PM As Alien51 alludes to, PHP runs only on the server side, JavaScript on the client (browser) side. Things like popping up child windows are client actions. You can provide similar functionality via PHP by displaying a sequence of web pages (probably storing form data in session variables or possibly in hidden form fields on the alert/confirmation pages). This may seem a bit clumsy compared to pop-up windows, but it avoids any dependency upon the user having JavaScript availabe and enabled. bokeh 07-13-2005, 03:21 PM You can also make your pages hybrid. Fork your code. Use javascript for fast client side actions and use PHP for redunancy. Obviously though you can only do this in areas where their tasking abilities overlap. A good example of this is form validation. You can do it client side with javascript for speed. You still need to validate the form server side for those not using javascript and for security reasons but for those that had their form validate with javascript the form will not need to be sent backwards and forwards to the server as there wont be any errors when it is submitted. LeeU 07-13-2005, 03:24 PM Here's an interesting trick using PHP to supply JavaScript with the date/time from the server instead of from the user's computer: ServerDate to JavaScript (http://javascript.internet.com/clocks/serverdate-to-javascript.html) webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |