I have a search page and a result page and an encoded array is passed between the two pages.
My problem is that I am now struggling to decode the array, to place the code in an SQL statement.
Search.php
echo "<table><tr>";
$i = 1;
$cols = 4; //number of columns;
while ($row = mysql_fetch_array($sql_result)){
$industry = $row["industry"];
$ret_industry = urlencode($industry);
if ($i > $cols){
echo "<tr>"; //create new row
print "<td class=general><input type=checkbox name=cbox value='$ret_industry' onClick=javascript:chkAll(this)>$industry</td>";
$i = 1; //reset counter;
}else{
echo "<td class=general><input type=checkbox name=cbox value='$ret_industry' onClick=javascript:chkAll(this)>$industry</td>";
$i++;
}
} //end while loop
echo "</table>";
On the second page I am reading in the string, but I need to amend my code to decode the string as it loops through the array.
Any ideas?
Result.php
$count=count($industry);
for ($i=0; $i<$count; $i++) {
// If $industry = all then search all industries
if($industry[$i] == "all"){
if($sql_where != "") {
$sql_where = $sql_where . "AND ";
}
$sql_where = $sql_where . " industry LIKE '%%' ";
}