techexpressinc Posted August 6, 2008 Share Posted August 6, 2008 I have an inframe PHP coded form within a HTML page. I like to have a pop-up window for more info. I can not figure out how. I think I have to exit the PHP secession and start a HTML secession and put in some javascript?? Can someone give some help on what direction to go and how? Thanks a Lot Russ Quote Link to comment Share on other sites More sharing options...
.josh Posted August 6, 2008 Share Posted August 6, 2008 You are correct in that you need to use javascript to make a popup. Quote Link to comment Share on other sites More sharing options...
techexpressinc Posted August 6, 2008 Author Share Posted August 6, 2008 i think you can jump from the php "secession" to the javascript do the pop-up and go back to the php or is it mission impossible to have a pop-up from my php form?? ??? Quote Link to comment Share on other sites More sharing options...
.josh Posted August 6, 2008 Share Posted August 6, 2008 php is parsed on the server and the results are sent to the client (your browser). Javascript is parsed on the client. All of the php script will be executed and results sent before a single piece of javascript is executed, no matter what kind of order you put it in. If you want some kind of "live" interaction, where you start off with php and have more php executed based off of js, look into ajax. Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 6, 2008 Share Posted August 6, 2008 I might be wrong, but I think he is saying that the HTML for the form is generated in a PHP file; in which case, it would be possible to make a pop-up window. What does your PHP code look like? Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted August 6, 2008 Share Posted August 6, 2008 it doesn't really matter how you write your php really as long as the javascript in your browser source is correct. if you would do something like <scr<?php echo("ipt>aler");?>t('alert something')</script> and you would check your html source it would show <script>alert('something')</script> and it would still work then again maybe you mean you want to have values from the popup to the parent page which is also possible Quote Link to comment Share on other sites More sharing options...
.josh Posted August 6, 2008 Share Posted August 6, 2008 well, you can use php to dynamically create text, and js/html is text to php so if you want the text to contain js code to be generated for a popup on one condition but not another, then to that extent, yes, you can use php to do that. Example: $x = 5; if ($x > 0) { // echo js for popup box here } else { // don't echo out js } That code will send the js popup code to the browser, but the point is, the condition will be parsed on the server, and the results will be sent to the browser. <?php echo "something here<br />"; ?> <script language='javascript'> document.write("blahblahblah"); </script> <?php echo "something else here <br />"; ?> php will parse that and send the following to the browser: something here<br /> <script language='javascript'> document.write("blahblahblah<br />"); </script> something else here <br /> So your browser is going to render that text in order, looking like this: something here blahblahblah something else here The point I'm trying to make is that even if the js was a popup, it will still be rendered in that order, and the 2nd php echoed string will still be there. If he has some php script running and suddenly wants a js popup box to confirm something, he can do that, but he can't for instance have the php script continue to run if he clicks yes, stop if he clicks no, because all of the php is already parsed on the server and sent to the browser. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.