girlcake Posted March 6, 2007 Share Posted March 6, 2007 Hello, If anyone is familair with the proxy2.de Advanced Poll maybe you can help me out, I've hit kind of a brick wall on a kind of small point. I've been working on some polls and could use some advice. you can see the test here: http://www.whatwouldhornblowerdo.com/hhtest.php I've set up multiple polls on a page and would like to add to it over time. Everything works fine but as the page gets longer, it is going to become more & more annoying that after voting on a particular poll, the page returns to the top and you have to scroll back down the page to see the results. So basically I would like to anchor the results, but I can't figure out where the PHP redirects back to the html to include the anchor id back. My idea was to use the "poll_id" variable to find its way back to an anchor point on each poll corresponding to it's own id. EXAMPLE: on the HTML: <a name="7" id="7"></a> in the PHP/Template/Somewhere (there are a lot of pages associated with this software)??: header (Location: <a href=#$poll_id></a> or maybe I can piggypack onto the Form Action and do it that way...I really am stuck on this... I've scoured the Files and was over at Support Forum for Advanced Poll, but no one seems to have any advice, so I thought maybe you guys would have an idea, this seems like a great place. as you can see, this is my first post here and to tell the truth, PHP isn't my strong suit, but I'm learning a lot through problem solving, so if someone just has a nudge in the right direction for me, even that would help. I really appreciate it, thanks, Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted March 6, 2007 Share Posted March 6, 2007 what you suggested above would work. that would be what i'd do. except your header would be invalid. header("Location: #{$poll_id}"); Quote Link to comment Share on other sites More sharing options...
girlcake Posted March 6, 2007 Author Share Posted March 6, 2007 GREAT! Thanks! That helps, now all I wonder is where in the multitude of files I give the redirection instruction... if anyone has the time to check out the files I've zipped up the files...way too much to post http://www.whatwouldhornblowerdo.com/db.zip I suspect the file where the redirect might be is "include/class_poll,php", but like I mentioned, this is not my area of expertise and this seems to be quite complicated code... again, I really appreciate any help anyone has and in the meantime I will continue to try to figure it out. Thanks Quote Link to comment Share on other sites More sharing options...
girlcake Posted March 6, 2007 Author Share Posted March 6, 2007 It also just struck me that the page reloads with the poll results anyway, so an actual redirect (a la header(Location:)) may be unnecessary. Basically whatever mechanism is already reloading the page with results is what perhaps actually needs the anchor info. I could be wrong about this... what type of code would be used to return/reload the page with poll results if not header (Location) thanks Quote Link to comment Share on other sites More sharing options...
girlcake Posted March 6, 2007 Author Share Posted March 6, 2007 This is the area of code in class_poll.php that I think may be displating the results...but I can't be sure. if ($this->is_valid_poll_id($poll_id)) { $voted = $this->has_voted($poll_id); $is_active = $this->is_active_poll_id($poll_id); if ($action=="results" && $poll_id==$poll_ident) { return $this->view_poll_result($poll_id,0); } elseif (!$is_active) { return $this->view_poll_result($poll_id,0); } elseif ($is_active && $voted) { return $this->view_poll_result($poll_id,1); } elseif (!$voted && isset($option_id) && $action=="vote" && $poll_id==$poll_ident) { $this->update_poll($poll_id,$option_id); return $this->view_poll_result($poll_id,0); } else { return $this->display_poll($poll_id); } } else { $error = "<b>Poll ID <font color=red>$poll_id</font> does not exist.</b>"; return $error; } } } Was wondering if that seems reasonable... Quote Link to comment Share on other sites More sharing options...
girlcake Posted March 7, 2007 Author Share Posted March 7, 2007 used <META HTTP-EQUIV="Refresh" CONTENT="0;URL=#<?php echo $poll_ident?>"> Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.