# 2 General Questions



## The Infinity (May 12, 2005)

*#1* I was wondering for my website how I would go about creating a poll. Is there anything simple out there that I could do for my website, perhaps a tutorial or something to teach me how to make a poll.

*#2* How do I remove .php off the end of the URL links to my website.

Example: Click on "Home" brings up www.mywebsite.com/home.php

I want to Click on "Home" and bring up www.mywebsite.com/home

Sorry if this seems like a nooby question but I have always wondered how to take off hte extension.


----------



## NicolaJane (Oct 6, 2003)

webpasties have some great tools for making polls and such 
http://www.webpasties.com and also have a complete tutorial http://www.webpasties.com/demos/create_web_poll.html on how to create one

however if you want to create one yourself, and want to use a form, here is a tutorial that will teach you to make one from scratch
http://www.w3schools.com/html/html_forms.asp


----------



## thecoalman (Mar 6, 2006)

The Infinity said:


> I want to Click on "Home" and bring up www.mywebsite.com/home


If you put a file called index.html in the directory www.yoursite/home/ it will serve it. Basically I set my sites up like that from scratch, www.yoursite.com/contact/... www.yoursite.com/about/ etc. I never use home though because it would be the base URL.

You can also redirect the file but if I remember correctly your on a windows server and I don't how you do it on windows server. If your on a Apache server the basics for htaccess can be found here: http://wsabstract.com/howto/htaccess.shtml


----------



## haswalt (Nov 22, 2004)

i suggest using the .htaccess method. I would set up your htaccess file to recognise all /home file etc as .php or something like that, alternatively you could make apache recognise certain folders as pages so www.yoursite.com/about/ would actually be www.yoursite.com/about.php but the users would see the first link.

another method would be use a single index page. if you are using php you could do the following.

put all the file together and simply include them into your index depending on what get variables are defined.

so you index.php could be empty and then you jsut link to www.yoursite.com?p=about

then make the index.php page include the about.php page or something like that then you would have smaller links.

Bear in mind google can't read the later method properly. you need to setup apache to server dynamic php links as static urls such as some sites and forums do.

Thanks,

Harry


----------



## The Infinity (May 12, 2005)

NicolaJane said:


> webpasties have some great tools for making polls and such
> http://www.webpasties.com and also have a complete tutorial http://www.webpasties.com/demos/create_web_poll.html on how to create one
> 
> however if you want to create one yourself, and want to use a form, here is a tutorial that will teach you to make one from scratch
> http://www.w3schools.com/html/html_forms.asp


I was just wondering about the create a poll from scratch link. I may be mistaken but does it show more of how to do it somewhere else on that page, because it looks like it's only telling me how to use the form. Is there one perhaps that will show how ot make the results page and such?

It seems not a lot of websites have a complete walk through of how to make one.


----------



## covert215 (Apr 22, 2006)

FYI- your site got pwnt


----------



## haswalt (Nov 22, 2004)

there are several ways to show the data,

either as text which is easy s it's a simple bit of matha nd a couple of echos.

or you can do it with graphics, like bar charts and such.

bvar charts are easiest, there are two ways to do it. You can use the php gd library if you have it enabled to create bar graphs, or use javascript to show the bar either way you get the same effect.

How you get the data to be shown depends entirely on how you created your poll.

If you managed to find a really simple one where you have 1 row per poll,then you can just extract that row. otherwise you may need to extract every row that matches that poll and tally all the numbers.

If you could give us more of an idea on what you want to do with the data we can give you some more relevant help.

Thanks,

Harry


----------



## The Infinity (May 12, 2005)

I would actually like a poll very similar to this one:

http://www2.jsonline.com/news/newspoll.asp

I want to have a poll for the week. I figured it would be a neat feature to add to my website.


----------



## Eriksrocks (Aug 7, 2005)

I really like the one on this page:
http://proxy2.de/scripts.php

Unfortunately it's in PHP so that won't be of much use to you.


----------



## covert215 (Apr 22, 2006)

Did you design your site yourself or did you use a CMS?


----------



## The Infinity (May 12, 2005)

I designed it myself, I has help from friends picking out diffrent things to add, but I coded it and all. I have just never has any experience with polls before.


----------



## Eriksrocks (Aug 7, 2005)

Have you looked on www.hotscripts.com?


----------



## covert215 (Apr 22, 2006)

Hotscripts has just about anything you could ever need. Free and commercial


----------



## Eriksrocks (Aug 7, 2005)

Here's some I quickly found with one search:
http://www.hotscripts.com/Detailed/44049.html
http://www.hotscripts.com/Detailed/53000.html
http://www.hotscripts.com/Detailed/50774.html


----------



## The Infinity (May 12, 2005)

I liked one of the ones on hotscripts which was exactly what I wanted the only thing is that I'm not sure if my hosting supports ASP since when I go to the file it tells me to to login when I need to login for the poll I just see all the code and not the actual structure of the code. The poll I am referring to is this one http://www.htmljunction.net/ezcodes.asp

And I have 1and1 web hosting with the Home package.

Also



haswalt said:


> i suggest using the .htaccess method. I would set up your htaccess file to recognise all /home file etc as .php or something like that, alternatively you could make apache recognise certain folders as pages so www.yoursite.com/about/ would actually be www.yoursite.com/about.php but the users would see the first link.


How would I go about doing this? I'm not too familiar with htaccess so I'm not really sure what I will need to tell it to get it to work to make it do what you said it can.


----------



## Eriksrocks (Aug 7, 2005)

Silly me... I assumed you were on a Windows server with ASP because of thecoalman's post - I guess you're on a Linux server with PHP then...

Use this script for the poll: http://proxy2.de/scripts.php

I used it and I really liked it. It's simple, but it has options. And it's simple enough that you can customize it if you have a fair knowledge of how it works. 

As far as .htaccess, check it out here: http://wsabstract.com/howto/htaccess.shtml
or here: http://www.google.com/search?&q=guide+to+.htaccess


----------



## covert215 (Apr 22, 2006)

.htaccess only works on apache servers


----------



## Eriksrocks (Aug 7, 2005)

Apache/Linux/UNIX, you get the idea.


----------



## covert215 (Apr 22, 2006)

oh...whoops, i assumed he was on a windows server like you


----------



## Eriksrocks (Aug 7, 2005)

Like me? I'm on Apache. 

http://www.erikswan.net/index.*php*


----------



## Eriksrocks (Aug 7, 2005)

The Infinity said:


> only thing is that I'm not sure if my hosting supports ASP since when I go to the file it tells me to to login when I need to login for the poll I just see all the code and not the actual structure of the code.


And then...


Eriksrocks said:


> Silly me... I assumed you were on a Windows server with ASP because of thecoalman's post - I guess you're on a Linux server with PHP then...


----------



## covert215 (Apr 22, 2006)

I meant that I made the assumption the he was on IIS, like you


----------



## Eriksrocks (Aug 7, 2005)

Oh. Like I thought he was on ISS, not that I'm on ISS. Gotcha.


----------



## covert215 (Apr 22, 2006)

It just took us 7 posts to get that resolved...


----------



## The Infinity (May 12, 2005)

Eriksrocks said:


> Silly me... I assumed you were on a Windows server with ASP because of thecoalman's post - I guess you're on a Linux server with PHP then...
> 
> Use this script for the poll: http://proxy2.de/scripts.php
> 
> ...


Thanks  Well I got the poll installed. but I can't get it to install.


```
Installation:

1. Open the configuration file 'config.inc.php' with a text editor
   and set up your database settings.

   $POLLDB["dbName"] = "YourDBName";
   $POLLDB["host"]   = "localhost";
   $POLLDB["user"]   = "YourUsername";
   $POLLDB["pass"]   = "YourPassword";

2. Call the install script from your browser -> http://www.yourURL.com/poll/install.php
```
I put in the following for "YourDBName" I put "poll" and of course filled out all the fields, except for localhost I'm not sure what I should put for that.

I'm not sure if for the username and password if I just make one up or am I supposed to put the one in for my ftp?


----------



## covert215 (Apr 22, 2006)

Do you have cPanel or phpmyadmin? You must create a db and a user account. Then, apply that user to the db. For the DB name, enter in the db you created, host is localhost, username/password are whatever the user account you created

if you pm me your account details, i could set it up in a minute


----------



## The Infinity (May 12, 2005)

Ah alright cool thanks for that I am not used to the databases yet. I got the thing installed now all I have to do is figure out how to add the poll to my website. I found the poll I want to add which is the first one from the demo, I just want to figure out how to add it to the website with the code. It gives me this code to use.


```
<?php
/* Include this before your html code */
include "./poll_cookie.php";
?>
<?php

/* path */
$poll_path = dirname(__FILE__);

require $poll_path."/include/config.inc.php";
require $poll_path."/include/$POLLDB[class]";
require $poll_path."/include/class_poll.php";
$CLASS["db"] = new polldb_sql;
$CLASS["db"]->connect();

$php_poll = new poll();

/* the first poll */
echo $php_poll->poll_process(1);


/* the second poll */
$php_poll->set_template_set("simple");
$php_poll->set_max_bar_length(80);
echo $php_poll->poll_process(2);


/* the third poll */
$php_poll->set_template_set("popup");
if ($php_poll->is_valid_poll_id(3)) {
    echo $php_poll->display_poll(3);
}

?>
```
Also since this is a demo poll does that mean it will expire or anything? Or does it just mean it doesn't have all the features or something.


----------



## covert215 (Apr 22, 2006)

I'm not familiar with your particular poll. So its installed?


----------



## The Infinity (May 12, 2005)

Yes it is I downloaded the one from the link that Eriksocks provided.


----------



## covert215 (Apr 22, 2006)

I mean installed as in db's configured, not installed as in the files are on the server


----------



## The Infinity (May 12, 2005)

Here is the link to where it brought me. http://www.softhardware.net/poll/db/demo_1.php

I link the first poll, so I would like to add that one to my website.


----------



## covert215 (Apr 22, 2006)

Ohhh....I've got it

They are all different kinds of polls. Depending on which poll you want, enter the necessary code


----------



## The Infinity (May 12, 2005)

um yes because I did not receive the error this time


----------



## Eriksrocks (Aug 7, 2005)

Once you installed it go to the directory you installed it in (for example /poll) and then go to /admin. So it would be like this if you installed it in the polls directory:

yoursite.com/poll/admin. It should bring up a login screen - put the username and password that you made when you went through the installation process. Then it should bring up a poll control panel. From there you can create polls, delete polls, customize them, and it will give you the right code.


----------



## covert215 (Apr 22, 2006)

On the page with the poll, enter the code at the top of the page:

<?php
/* Include this before your html code */
include "./poll_cookie.php";
?>

To use the 1st poll, put this code in your body wherever you want it. Be sure to change the _FILE_ to your directory name:
<?php

/* path */
$poll_path = dirname(__FILE__);

require $poll_path."/include/config.inc.php";
require $poll_path."/include/$POLLDB[class]";
require $poll_path."/include/class_poll.php";
$CLASS["db"] = new polldb_sql;
$CLASS["db"]->connect();

$php_poll = new poll();

/* the first poll */
echo $php_poll->poll_process(1);

/* the second poll */
$php_poll->set_template_set("simple");
$php_poll->set_max_bar_length(80);
echo $php_poll->poll_process(2);

/* the third poll */
$php_poll->set_template_set("popup");
if ($php_poll->is_valid_poll_id(3)) {
echo $php_poll->display_poll(3);
}

?>


----------



## The Infinity (May 12, 2005)

Cool I got it to work now, the only thing I need to know is if there is a way to take off the thing on the top of the poll where it says "Advanced Poll" and if I can change the background color and such. If so how to do it


----------



## The Infinity (May 12, 2005)

Never mind I take that last post back


----------



## covert215 (Apr 22, 2006)

Did you just go to the admin options?


----------



## The Infinity (May 12, 2005)

Yeah, it was in there. And as for it working I got it to show up, but when I try and submit a vote it tells me the certain page I was referring to could not be found. could this be because I put that php inside of php? I'm not real sure why it wouldn't work at this point.


----------



## Eriksrocks (Aug 7, 2005)

It's giving your variables to a page that doesn't exist. What page is it that can't be found (look in your address bar)?


----------



## The Infinity (May 12, 2005)

it is saying http://www.softhardware.net/includes/includes_quicklogin.php which is my quick login php page I made, which I was trying to add the poll under the information that was there.


----------



## Eriksrocks (Aug 7, 2005)

Hmm... It should work. It should just reload the page and then the PHP code takes the form info and counts the vote, etc...


----------



## The Infinity (May 12, 2005)

Here check the website now http://softhardware.net

you can check out what I'm talking about. I'll leave it up until to respond.


----------



## covert215 (Apr 22, 2006)

It looks good as is...where exactly do you want it?

also, did you get my pm?


----------



## The Infinity (May 12, 2005)

Yes I did 

Yeah I like the way it looks, it's just not submitting votes properly.


----------



## Eriksrocks (Aug 7, 2005)

Sorry, but I don't even see the poll on the page...


----------



## covert215 (Apr 22, 2006)

Its on the home page, right below the log in box.

Actually, its been removed. It looked fine as it was before. You just needed to tweak the colors to match the site.


----------



## Eriksrocks (Aug 7, 2005)

The Infinity, can you put it back up again? I need to try it out to figure out what's wrong, unless you've already fixed it yourself.


----------



## The Infinity (May 12, 2005)

Oh sorry, I figured you had logged of so I took it off to fix something and forgot to put it back up  I just didn't want my members to see the non-working poll 

There you go it's back up


----------



## Eriksrocks (Aug 7, 2005)

What is the PHP code that is putting the form on the page? Can you post it here?

Anyway, if you can, change it from includes_quicklogin.php to index.php.


----------



## The Infinity (May 12, 2005)

Well see I have it to where each section is in php so let me show you the sections.

http://img242.imageshack.us/img242/2954/untitlednj5.jpg

And here is the code for the includes_quicklogin.php page with the poll still coded inside it:


```
<?php
// Important! You have to include it before your html code
include_once "/homepages/16/d173458780/htdocs/poll/db/poll_cookie.php";
?>

  [IMG alt=""]http://www.softhardware.net/images/bullet.gif[/IMG] [B]Log In       [/B]  [[URL=http://forums.softhardware.net/index.php?act=Reg&CODE=00] Sign Up[/URL] [B]|[/B] [URL=http://forums.softhardware.net/index.php?act=Reg&CODE=10]Lost Password? [/URL]]

   Please enter your details below to log in
  [TABLE]
  [TR]
    [TD] Username[/TD]
    [TD][/TD]

  [/TR]
  [TR]
    [TD] Password[/TD]
    [TD][/TD]
  [/TR]
  [/TABLE]

    

<?php
include_once "/homepages/16/d173458780/htdocs/poll/db/booth.php";
echo $php_poll->poll_process(4);
?>
```


----------



## The Infinity (May 12, 2005)

I also found out it works when I put it onto a blank php page.

http://www.softhardware.net/1.php

So I'm thinking it just doesn't like some of my code somewhere.


----------



## Eriksrocks (Aug 7, 2005)

I think the problem is that it is designed to reload the page that it is on and then the PHP code on the page takes care of the voting/results. So it thinks the poll is on includes_quicklogin.php, which it is, but it is really being displayed on index.php, so then it reloads includes_quicklogin.php in the browser, which causes errors.

You need to move the poll code to the actual index.php file, and work it so that it is below the code to include includes_quicklogin.php, and then once you get it to display right, it should register the votes correctly...


----------



## haswalt (Nov 22, 2004)

ok anyone still having a problem with polls?

if so i can write a simple one here for you,

thanks

Harry


----------



## The Infinity (May 12, 2005)

I still am, but I have given up on it. I learned a lot about the MySQL databases and such but I don't think a poll is going to fit in with my website very well right now.


----------



## haswalt (Nov 22, 2004)

you don't have to use mysql to run a poll you can simply use flat file databases which run on any server. A decent poll should be able to fit in with any site.

give me a shout and i'll throw you some help together.

Harry


----------



## The Infinity (May 12, 2005)

Thanks I appreciate it


----------

