gudfry Posted July 18, 2008 Share Posted July 18, 2008 hi maybe i was in the the wrong area, Sory for convenience, I was looking for a code to test, and i found this code. when I reun it to my browser it has no action happen, i dont know if i was correct. the code is not function well. any idea with this to make the code work?? pls help me. <?php msgbox("Are you sure?", "confirm"); $result=""; if ($result == "ok") { // Perform some "ok" action here... } else { // Perform some "cancel" action here... } function msgbox($msg, $type) { if ($type == "alert") { // Simple alert window ?> <script language="JavaScript"> alert("<?php echo $msg; ?>"); </script> <?php } elseif ($type == "confirm") { ?> <script language="JavaScript"> if (confirm("<? echo $msg; ?>")) { <?php $result == "ok"; ?> } else { <?php $result == "cancel"; ?> } </script> <?php } } ?> thanks in advance Quote Link to comment Share on other sites More sharing options...
corbin Posted July 18, 2008 Share Posted July 18, 2008 PHP is server side. Javascript is client side. PHP will be processed before it's ever sent to the user. Javascript is processed when the user gets the page. Also, based on some of your syntax, you don't understand PHP basics. Maybe google a little? 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.