Jump to content

Checking for null. (JavaScript & PHP)


sepoto

Recommended Posts

I am trying to check for null but the code here is not achieving that result yet. I have tried a few variations of the below code but I have not really cracked it yet. Does anyone have suggestions? I just want to check for null as below:

<?php header('Content-type: text/javascript'); ?>(function() {//function//window.onload//window.onloadwindow.onload = function() {// Creating a reference to the mapDivvar mapDiv = document.getElementById('map');// Creating a latLng for the center of the mapvar latlng = new google.maps.LatLng(37.09, -95.71);// Creating an object literal containing the properties// we want to pass to the mapvar options = {center: latlng,zoom: 4,mapTypeId: google.maps.MapTypeId.ROADMAP};//window.onload// Creating the mapvar map = new google.maps.Map(mapDiv, options);////////////////////////////////////////////////////////////////////google.maps.event.addListener(map, 'bounds_changed', function() {window.bounds = map.getBounds();if("<?php echo $physical_address; ?>" == null) alert("Alert Sepy.");});////////////////////////////////////////////////////////////////////}//window.onload})();//function

Link to comment
Share on other sites

In this case the $physical_address came from an html form text field initialized to value="". So the correct code turns out to be if("<?php echo $physical_address; ?>" == "") alert("Alert Sepy."); as opposed to what I have in my original posting. It works very well this way.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...