Page 1 of 1
Comparison form
Posted: Wed Jul 20, 2005 2:38 pm
by DeeZee
I'm a total n00b, so please ...
I'm planning to build a comparison for like the one seen
here or just two drop down menus with "compare it" button
I do not know what I'm looking for or where can i get a tutorial for this so could someone point me out, please ?
Thanks in advance...
Posted: Wed Jul 20, 2005 4:46 pm
by Burrito
what you need to do is create an array for your checkboxes then select off of the db for the items that were selected.
all of the item info will need to be in the db *obviously* and then you can fetch the info for the different items selected accordingly.
ex:
Code: Select all
<?
if(isset($_POST['items'])){
foreach($_POST['items'] as $item){
$result = mysql_query("select * from items where id = $item")
or die(mysql_error());
$row = mysql_fetch_assoc($result);
echo $row['itemname']."<br>";
echo $row['itemdesc']; //etc
}
}
?>
<form method="post">
<input type="checkbox" name="items[]" value="1">First Item<br>
<input type="checkbox" name="items[]" value="2">Second Item<br>
<input type="checkbox" name="items[]" value="3">Third Item<br>
</form>
Posted: Wed Jul 20, 2005 6:14 pm
by DeeZee
Thank you very much!
Can you point me to some more reading, maybe a tutorial, a guide?
Posted: Wed Jul 20, 2005 6:17 pm
by Burrito
best suggestion I can make is for you to get started then return here for any questions you have as they develop.
other option would be to start googling for your answers...also check the tutorials section on this web site, you might find some helpful resources there.
Posted: Wed Jul 20, 2005 7:14 pm
by DeeZee
I was afraid your answer would be like that
Thank you anyway...