In many computer programming languages, I always use message box to trace the errors or doing trouble shooting. However PHP do not come with a message box function. It makes the trouble shooting not so convenience. Luckily I can embed JavaScript inside the PHP code to do that. The following is a simple example to trace a variable.
<? // Declare a variable $user = 'Alex, Hello World'; echo "Tracing the variable"; // Trace the $user variable with an alert box echo " <script language=\"javascript\">window.alert('The user variable is: $user')</script> "; ?>
Demo:
Leave a Reply