is php or javascript more secure when populating dropdown boxes -


which better security standpoint when populating html select box?

option a: php

<?php echo "<select name=\"empname\" id=\"empname\" class=\"text\" style=\"width:10em;\">\r\n";?> <?php include 'phpscripts/getemployeenamesdb.php'?> <?php echo "</select>\r\n";?> 

getemployeenamesdb.php

$dropdown = "";      $tbl_name="employee"; // table name  $result = mysql_query("select concat_ws(' ', firstname, lastname) 'wholename', empid     $tbl_name order lastname") or die("cannot select result db.php");        while($row = mysql_fetch_assoc($result)) {             $empid = $row["empid"];              $name = $row["wholename"];              $dropdown .= "<option value=\"$empid\">$name</option>\r\n";  }   echo $dropdown; 

option b: javascript

same information except use ajax call populate javascript variable. use javascript make select statement?

security primary concern know if can come other concerns should consider.

the security see here have 1 more layer deal if go ajax route. php purely communication between server scripts. ajax have communication end users browser on network, which, can anything. user can use js if want , supplement query depending on how js builds query.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -