Creating a Poll out of PHP – So Close But Still So Far

For this week’s readings, going through the articles definitely helped clear up some questions I had regarding WordPress, and I am excited to use some of the tools we read about — i.e. custom post types and meta boxes — to create my personal site and have included them as modification options in my final pitch.

For this week’s PHP exercise, I used the W3School’s tutorial on how to make a poll to try and create a basic poll for my homepage. The tutorial talked about AJAX — Asynchronous JavaScript and XML — and was a little more advanced then what we’ve covered so far in the Codecademy lessons and in class. However, I really wanted to try this example because I would like to, if possible, create a poll for the blog I want to build for my final project. I want to create a book review blog and have people vote on the next book I should read, and I tried to make a basic example of this this week.

However, I wasn’t completely successful. I was able to modify the HTML and most of the PHP correctly and got the poll to display and be clickable. The major hurdle I’ve come across is that I cannot get the site to accurately show the updated results of the poll on the page after the click, the way the tutorial intends. I think the issue lies somewhere in the way my PHP file is interacting with the text file I am using to store my poll data, but, to be honest, I’m not entirely sure where I’m going wrong. I will keep working on the code to see if I can get the outcome to show up the way it’s supposed to before class on Wednesday.

In terms of creating a poll for my final project, I am still really interested in the idea and have found a plug-in I think I may be able to use that will help make the process easier, since other tutorials I looked at for creating polls seemed to suggest you need to create a database and I think that may be too challenging, especially after my struggle this week.

GitHub link: https://github.com/tatyanaberdan/phpassignment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.