Doing a comparison of records

Good evening, I was wondering how someone would go about comparing multiple records on a web page. For example:

If a page has 10 records on it and there was a checkbox next to each record. If 3 of the boxes where checked and someone clicked next they would be sent to a page that would compare those 3 records side by side with any of the informaiton from the database.

If this is extremely difficult please let me know ahead of time. I am hoping someone has an example to show me how to do this. If not just let me know. Thank you for your time and have a great evening.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Loganathan NatarajanLAMP DeveloperCommented:
what i could understand from you questions is, from the 10 records you select 3 records and take it to next page ... here want to compare with db these 3 records??? am i correct?
pertrai1Author Commented:
Yes that is exactly what I want to do
Loganathan NatarajanLAMP DeveloperCommented:
i assume in the page1.php ... check box contains (like mail in box display)....

<form name="frm1" method="post">
<INPUT TYPE="checkbox" NAME="s[]" VALUE="A" CHECKED>Checkbox 1<BR>
<INPUT TYPE="checkbox" NAME="s[]" VALUE="B">Checkbox 2<BR>
<INPUT TYPE="checkbox" NAME="s[]" VALUE="C">Checkbox 3<BR>
</form> ... just print ....


print_r ($_POST);

also , it will display

the same PHP code will produce the output below:

Array (
    [0] => A
    [1] => B
    [2] => C

<< loop it all the records (10)>>
// loop through the array and process index key values
check single value with == db connected value ..

do the process...



more detailed at,

      <form action="checkbox.php" method="post">
        <input type="checkbox" name="checkbox[]" value="a">
        <input type="checkbox" name="checkbox[]" value="b">
        <input type="checkbox" name="checkbox[]" value="c">
        <input type="checkbox" name="checkbox[]" value="d">
        <input type="submit" name="Submit" value="Submit">
      /* and in your checkbox.php you do this: */
          for ($i=0; $i<count($_POST['checkbox']);$i++) {
             echo "<br />value $i = ".$_POST['checkbox'][$i];

Open in new window

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Loganathan NatarajanLAMP DeveloperCommented:
>> in the process loop again you have to connect the DB value and get it checked with these selected items..
pertrai1Author Commented:
logudotcom, you have me going on the right track. Now just to make sure I can do this right, let's say that each record in the database has the fields name, age, position, class and I want all of these values to be shown for each checkbox that is clicked, side by side on the checkbox page, what would I need to do this. I can see passing one value for each checkbox, but how about all of the information for each record. Thank you for your help.

Loganathan NatarajanLAMP DeveloperCommented:
I want all of these values to be shown for each checkbox that is clicked,

>> It could be shown as we display the check boxes ... look at the code attached...

I can see passing one value for each checkbox, but how about all of the information for each record.

>> do you want to see those entire values in another page???

<form action="checkbox.php" method="post">
<? for ($i=0; $i <= $rowcount_rs_user; $++) { ?>
<input type="checkbox" name="checkbox[]" value="<?<?=$rs_user[$i]["id"]?>?>"><?=$rs_user[$i]["name"]?> <?=$rs_user[$i]["age"]?>  <?=$rs_user[$i]["position"]?> <?=$rs_user[$i]["class"]?>
<? } ?>
<input type="submit" name="Submit" value="Submit">

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.