|
|
|
| Title : |
Alert in JavaScript and Trace in Flash Action script are two commands that I find very much useful for tracking and debugging errors in my scripts. Unfortunately, there is no such option in PHP. |
| Categories : |
PHP, Java Script, Debugging |
 Sumit Agarwal |
| Date : |
Oct 19th 2007 |
| Grade : |
3 of 5 (graded 2 times) |
| Viewed : |
3167 |
| File : |
No file for this code example. |
| Images : |
No Images for this code example. |
|
| Search : |
More code by Sumit Agarwal |
|
| Action : |
Grade This Code Example
|
|
| Tools : |
My Examples List |
|
|
|
|
|
|
Even though a simple echo can do the work most of the time, printing the message can break the layout at times. And at such times, this code can come handy :
| <?php
function alert($msg)
{
$msg = addslashes($msg);
$msg = str_replace("\n", "\\n", $msg);
echo "<script language='javascript'><!--\n";
echo 'alert("' . $msg . '")';
echo "//--></script>\n\n";
}
?>
<html>
<head>
<title>My Test Script</title>
</head>
<body>
<?php
$a = 50;
$b = ($a = 0) ? 'Empty' : 'Not Empty';
alert($a);
alert($b);
alert("\"Test sentence having quotes.\"");
alert("Another test sentance spanning multiple lines.");
?>
</body>
</html> | | |
|
| This PHP function creates dropdown select lists for time and date that you can change, outputs a 14 char MySQL timestamp in a text field Categories : PHP, MySQL, Java Script, HTML and PHP | | | PHP4 session helper HTML file.
Categories : PHP, Java Script, HTML and PHP, Sessions | | | phpDocumentor 1.1.0 - automatic documentation tool for PHP. Generates API documentation in HTML, PDF, and CHM formats with automatic linking, smart inheritance and packaging, very fast and stable. Official website
http://www.phpdoc.org Categories : Complete Programs, Debugging, PHP, Documentation | | | PhpView 0.1 - simple php viewer, using temporary files and frames.
Categories : PHP, PHP Options and Info, Debugging, HTML and PHP | | | PHP and javascript mouseover, mouseout, and mousedown events Categories : PHP, Java Script, Form Processing, Beginner Guides | | | Local-to-user date and time display regardless of time zone or where the website's server is located Categories : PHP, Date Time, HTML and PHP, Java Script | | | Easy alert box pop-up function Categories : PHP, Java Script, Beginner Guides | | | Date Validation using JavaScript. Intended to use it as checkdate() from PHP. Categories : Java Script, Date Time, PHP | | | Classic guest book made with PHP and Flash Categories : PHP, Flash, Java Script | | | The Ajax Tree view class fetches data from a db for the requested parent category id. The data is then stored in an array and converted into JSON (Javascript Object Notation) format. This format is then used by JavaScript for populating tree view. Categories : PHP, PHP Classes, Java Script, AJAX, Databases | | | Javascript/DHTML menus without all the extra javascipt.... server side browser detection + dynamically generated javascript (build menus on fly using php) Categories : PHP, Java Script, Navigation | | | AJAX Data Grid System using php and mysql. A complete login system with the ability to display data in a grid using ajax. Add , update and delete the records without reloading the page. Categories : PHP, AJAX, Databases, MySQL, Java Script | | | Password using php, Javascript, and html form Categories : Security, PHP, Authentication, Java Script | | | Popup window creator for images on the Fly. Categories : PHP, GD image library, Java Script | | | This is a script that list all image files on a given directory, and displays
the thumbnails nicely formated within an HTML table. It also make use of
JavScript to open pop up windows when the users want to see the full photo. Categories : Graphics, PHP, Complete Programs, Java Script | |
|
|
|