iam using php in developing our website which is our user has to check banana symptoms that he observe on his plantation,out of that checked symptoms our system will show the possible disease based on what he checked, but i have a problem, if i checked 1 and 4 checkbox it will show the same output, i want that if i checked that both checkbox it will give one output only this is my code: pls help me!! thank you. .
<?php
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("banana",$con) or die("WALEY");
?> <?php
$sql = "select * from page";
$qury = mysql_query($sql);
while($row = mysql_fetch_array($qury))
if(isset($_GET["checkbox"])){
$f= $_GET["checkbox"];
$c = count($f);
echo "<ul><u><b>The Diseases found is: </b></u></br></ul>";
for($i = 0 ; $i<$c;$i++){
if($f[$i]>=6 && $f[$i] <=10){
echo "<li><a href = '$row[0]'><b>Moko Disease</b><a></li><br>";
}
if($f[$i]>=11 && $f[$i]<=16){
echo "<li><a href = '$row[1]'><b>Panama Disease</b><a></li><br>";
}
if($f[$i]>=1 && $f[$i]<=5){
echo "<li><a href = '$row[2]'><b>Bunchy-top Disease</b><a></li><br>";
}
}
}else{
echo "<br><a href = 'checklist.php'><b>Please check your symptoms</b><a>";
}
?>
ivylyn
0
Newbie Poster
Recommended Answers
Jump to PostOK, quick question, what if the maximum number of checkboxes? If less than 32 - and always will be less than 32, we can use a bitwise trick. Example here: http://demos.diafol.org/bitwise-checkboxes.php
BTW you should post your form html. Otherwise we're guessing as to how you've implemented it.
All 4 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.