//ส่งค่าเป็น all มาเลย if($_POST[type]=='all'){ $sql="select * from table where type='animal' or type='tree'"; //หรือแบบนี้ก็ได้ $sql="select * from table"; // select จากทุก type }else{ $sql="select * from table where type='$_POST[type]'"; }
<select name='op'> <option value='all'>All</option> <option value='animal'>Animal</option> <option value='tree'>tree</option> </select> if($_POST['op'] == 'animal'){ $sql = "select * from tb_name where type = 'animal'"; }else if($_POST['select'] == 'tree'){ $sql = "select * from tb_name where type= 'tree'"; }else{ $sql = "select * from tb_name"; } $query=mysql_query($sql);
if($_POST[type]) { $type = $_POST["type"]; $color = $_POST["color"]; if($type=="animal") { $query_where ="WHERE type ='animal' AND color ='$color' ";} //animal if($type=="tree"){ $query_where ="WHERE type ='tree' AND color ='$color' ";} //tree if($type=="all") { $query_where ="";} //all $sql="select * from table $query_where "; $query=mysql_query($sql); }
$sql="SELET * FROM `table`"; if(isset($_POST['type']) && $_POST['type']!=='all') { $sql = sprintf( "%s WHERE `type` ='%s' AND `color` ='%s'", $sql, (function_exists('mysql_real_escape_string')?mysql_real_escape_string($_POST['type']):mysql_escape_string($_POST['type'])), (function_exists('mysql_real_escape_string')?mysql_real_escape_string($_POST['color']):mysql_escape_string($_POST['color'])) ); } $query=mysql_query($sql);
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง