Changeset 285 for trunk/phpbms/choicelist.php
- Timestamp:
- 08/27/07 14:05:27 (5 years ago)
- Files:
-
- 1 modified
-
trunk/phpbms/choicelist.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/choicelist.php
r218 r285 39 39 require_once("include/session.php"); 40 40 41 function deleteList($listname){ 42 global $dblink; 41 42 class choiceList{ 43 var $db; 44 45 function choiceList($db){ 46 $this->db = $db; 47 } 48 49 50 function deleteList($listname){ 51 $querystatement="DELETE FROM choices WHERE listname=\"".$listname."\" "; 52 $queryresult=$this->db->query($querystatement); 43 53 44 $querystatement="DELETE FROM choices WHERE listname=\"".$listname."\" ";45 $queryresult=mysql_query($querystatement,$dblink);46 if(!$queryresult)47 reportError(100,"SQL Statement Could not be executed.");48 else49 54 echo "ok"; 50 } 51 52 function addToList($listname,$value){ 53 global $dblink; 55 } 54 56 55 $querystatement="INSERT INTO choices (listname,thevalue) VALUES(\"".$listname."\",\"".$value."\") "; 56 $queryresult=mysql_query($querystatement,$dblink);57 if(!$querystatement)58 reportError(100,"SQL Statement Could not be executed.");59 else 57 58 function addToList($listname,$value){ 59 $querystatement="INSERT INTO choices (listname,thevalue) VALUES(\"".$listname."\",\"".$value."\") "; 60 $queryresult=$this->db->query($querystatement); 61 60 62 echo "ok"; 61 }63 } 62 64 63 function displayList($queryresult,$blankvalue){ 64 while($therecord=mysql_fetch_array($queryresult)){ 65 $display=$therecord["thevalue"]; 66 $theclass=""; 67 if($therecord["thevalue"]==""){ 68 $display="<".$blankvalue.">"; 69 $theclass=" class=\"choiceListBlank\" "; 70 } 71 ?><option value="<?php echo $therecord["thevalue"]?>" <?php echo $theclass?>><?php echo $display?></option><?php 72 }//end while 73 74 } 75 65 66 function displayList($queryresult,$blankvalue){ 67 while($therecord=$this->db->fetchArray($queryresult)){ 68 $display=$therecord["thevalue"]; 69 $theclass=""; 70 if($therecord["thevalue"]==""){ 71 $display="<".$blankvalue.">"; 72 $theclass=" class=\"choiceListBlank\" "; 73 } 74 ?><option value="<?php echo $therecord["thevalue"]?>" <?php echo $theclass?>><?php echo $display?></option><?php 75 }//end while 76 77 } 78 76 79 function displayBox($listname,$blankvalue,$listid){ 77 global $dblink; 80 $blankvalue = str_replace("<","",$blankvalue); 81 $blankvalue = str_replace(">","",$blankvalue); 78 82 79 $blankvalue=str_replace("<","",$blankvalue); 80 $blankvalue=str_replace(">","",$blankvalue); 81 82 $querystatement="SELECT thevalue FROM choices WHERE listname=\"".$listname."\" ORDER BY thevalue;"; 83 $queryresult=mysql_query($querystatement,$dblink); 84 if(!$querystatement) reportError(100,"SQL Statement Could not be executed."); 83 $querystatement = "SELECT thevalue FROM choices WHERE listname=\"".$listname."\" ORDER BY thevalue;"; 84 $queryresult = $this->db->query($querystatement); 85 85 ?> 86 86 <p id="MLListP"> 87 87 <select id="MLlist" name="MLList" size="12" onchange="updateML(this)"> 88 <?php displayList($queryresult,$blankvalue)?>88 <?php $this->displayList($queryresult,$blankvalue)?> 89 89 </select> 90 90 </p> … … 102 102 <p id="MLStatus" class="small"> </p> 103 103 <div align="right"> 104 <input type="button" id="MLok" name="MLok" value="ok" class="Buttons" style="width:75px;" onclick="clickOK('<?php echo $_SESSION["app_path"]?>','<?php echo $listid?>','<?php echo $listname?>')"/>104 <input type="button" id="MLok" name="MLok" value="ok" class="Buttons" style="width:75px;" onclick="clickOK('<?php echo APP_PATH?>','<?php echo $listid?>','<?php echo $listname?>')"/> 105 105 <input type="button" id="MLcancel" name="MLcancel" value="cancel" class="Buttons" style="width:75px;" onclick="closeBox('<?php echo $listid?>');"/> 106 106 </div> 107 107 <?php }//end function 108 109 }//end class 110 111 112 113 114 108 115 109 116 if(!isset($_GET["cm"])) … … 112 119 if(!isset($_GET["ln"])) 113 120 $_GET["ln"]="shippingmethod"; 121 114 122 if(!isset($_GET["bv"])) 115 123 $_GET["bv"]="none"; 124 125 $theList = new choiceList($db); 126 116 127 switch($_GET["cm"]){ 117 128 case "shw": 118 displayBox($_GET["ln"],$_GET["bv"],$_GET["lid"]);129 $theList->displayBox($_GET["ln"],$_GET["bv"],$_GET["lid"]); 119 130 break; 120 131 case "del": 121 deleteList($_GET["ln"]);132 $theList->deleteList($_GET["ln"]); 122 133 break; 123 134 case "add": 124 addToList($_GET["ln"],$_GET["val"]);135 $theList->addToList($_GET["ln"],$_GET["val"]); 125 136 break; 126 137 }