[SOLVED] Validate variable : Alert Message
Posted: Tue Jun 28, 2005 11:51 pm
Hi,
I'm pulling some fields from a DB and displaying them in a dropdown.
Then there is a button to view records. Currently if I select nothing from the Drop Down it popups a page with no contenets from the DB, just the empyt tables. How could I go about creating and error javascript popup?
Get dropdown code :
Button triggers this function :
Tia, Will./
I'm pulling some fields from a DB and displaying them in a dropdown.
Then there is a button to view records. Currently if I select nothing from the Drop Down it popups a page with no contenets from the DB, just the empyt tables. How could I go about creating and error javascript popup?
Get dropdown code :
Code: Select all
function listCat() {
$sql_query = mysql_query("SELECT paperCategory, paperCategoryId FROM aupapercategory");
$output = "<select name=\"paperCategoryId\">\n";
$output .= "<option value=\"\">-- Select Option --</option>\n";
while(list($catname, $paperCategoryId)=mysql_fetch_array($sql_query)) {
$catname = stripslashes($catname);
$output .= "<option value=\"$paperCategoryId\">$catname</option>\n";
}
$output .= "</select>";
mysql_free_result($sql_query);
return $output;
}Code: Select all
function view($stockId) {
echo "<script language=\"javascript\">var newWindow = window.open
('".$_SERVER['PHP_SELF']."?action=viewFaceStock&stockId=".$stockId."','','scrollbars=yes,status=yes,windowX=10,windowY=10,width=440,height=550')</script>";
}