Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

SmartyPaginate: Using a checkbox to compare results

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
Rick Sinclair
Smarty Rookie


Joined: 20 Aug 2007
Posts: 5
Location: Seattle, WA

PostPosted: Mon Sep 24, 2007 12:50 am    Post subject: SmartyPaginate: Using a checkbox to compare results Reply with quote

I'm trying to figure this out and I've been picking up pieces of information in order to try and put the puzzle together and I would really appreciate some help. Thanks in advance:

I can get 20-30 results in smartyPaginate that I'd like to give my user a checkbox (named "compare") within each result so that they can then hit a button and reduce those results down to the ones they've checked. Here's what I think I know so far:

In the tpl:

Code:


{foreach item="curr_section" from=$data}

...I have "curr_section" items displaying data from each row of the $data array, built on a mySQL query, by a foreach function...

I've added a checkbox, like such:
<input type="checkbox" name="compareResults" /> that gets placed inside each foreach iteration.

{/foreach}

And inside of a tabbed panel I have a button, like:

<form method=get action="compare_tires.php">
<description stuff>
<input type="button" value=" Compare ">
<INPUT TYPE=HIDDEN NAME="compareResults">
</form>



Will the approach be to write the keyed $data.tirenum into the compareSearch array for each curr_section where the checkbox "compareSearch == 1" ??? Then, search the database again looking for matches of 'tirenum' in the compareSearch array and rebuild another $data array, then rerun the previous pagination foreach iteration for the new results...??? If so, what would that php look like that stores the 'tirenum' based off the "checkbox == 1" for each curr_section??? I'm not sure it's feasible to assign a checkbox value to a curr_section within smartyPaginate(?). Am I missing a step (or two) here?

Or,

Do I run the button "compare" back over the same page and use if statements to show/hide the curr_section based on whether the curr_section's compareSearch checkbox has been checked? Again, I'm not sure how that would look either. (I guess it's the checkbox's association with each foreach iteration that's drilling a hole in my head.) Confused

I'm not really wanting to take the items marked "compare" and load them into a new page. I'm really just wanting to reduce the results from 20-30 down to say, 3 or 4. The user can click on each item to see more details if they choose.

Ugh, the growing pains of knowledge: A little help for the uneducated, please!

Rick
_________________
New to web programming. Done C# and micro-controllers in the past. It's the simple things that hang me up.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP