Jump to content


Photo

Including my poll script on other pages


  • Please log in to reply
1 reply to this topic

#1 centenial

centenial
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 03 May 2006 - 01:29 PM

I have just finished coding a poll script. Now I want the option to include it on other pages with a few lines of code. How would I go about doing this? I tried:

<?php

include 'poll.php?id=1'; // Or 2, 3 etc. depending on the poll

?>

Where the poll.php is the file that generates the poll, allows the user to vote, and generates the results. But that gave me an error. I guess you can't have ?variable=somevalue strings when you include a file. Which I need to do, because the poll.php script needs an $id to generate the poll correctly. Any other ideas about how I would do this?

Also, one other problem - In the poll.php script there are a few links. Like:

<a href="poll.php?method=results">Click Here to View the Results</a>
If I include that on my other pages, the link will take them off to the poll.php page - How do I avoid doing that and make sure that all the functions stay on the page I include the script on?

Thanks,

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 03 May 2006 - 02:02 PM

You cant use querystring inside of calls to include(), you'll need to change the design of your poll to suite.

And as for making the links point to the current page, surely that would make them invalid.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users