Start New Discussion Reply to this Discussion question
how can i search names according to checkbox values from database table
chanchal.os
Newbie Poster
2 posts since Oct 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
Exg:
In your Form ..
<input type="checkbox" name="chk[]" value="1" />
<input type="checkbox" name="chk[]" value="2" />
<input type="checkbox" name="chk[]" value="3" />
In action page
<?php
if($_POST['chk']) {
$chekedValues= array();
$chekedValues = $_POST['chk'];
$append="";
foreach ($chekedValues as $key=>$value) {
$append.=($key==0) ? 'WHERE ' : 'OR';
$append.= " db_table_field_name="."'".$value."'";
}
$sqlsearch = mysql_query("SELECT * FROM db_table_name ".$append);
while ($row = mysql_fetch_array($sqlsearch))
{
}
}
?>
Bachov Varghese
Junior Poster
123 posts since Sep 2011
Reputation Points: 41
Solved Threads: 29
Skill Endorsements: 3
© 2013 DaniWeb® LLC
Page generated in 0.0617 seconds
using 2.68MB