Jump to content

Including my poll script on other pages


centenial

Recommended Posts

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:

[code]<?php

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

?>[/code]

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:

[code]<a href="poll.php?method=results">Click Here to View the Results</a>[/code] 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,
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.