Jump to content

Php Mock Version Of Google Forms


Psychology_Student

Recommended Posts

I'm interested in creating online forms in a similar fashion that Google allows whenever using Google Docs, but with greater functionality and reliability. (A problem that I have experienced when creating forms by Google is that it doesn't handle a large number of questions very well, either freezing up or not saving new questions upon form creation. Other times, I have heard complaints where a user may have spent a good bit of time filling out a form only to discover that it wasn't saved upon clicking the submit button like it should have been.)

 

For example, I might create questions looking like this:

 

Page 1

 

1. ) Do you eat any meat? ( ) Yes ( ) No

 

Page 2

 

What kind of meats do you eat?

 

2.) Beef Yes [ ] No [ ]

3.) Pork Yes [ ] No [ ]

4.) Veal Yes [ ] No [ ]

 

Using Google Forms, I'd then indicate if the user says they don't eat ANY meat, then skip the section on specific types of meat they might eat, which is fine when dealing with a small number of questions, but not for a large number. What I want to be able to do is create a large number of questions in this manner without worrying about the technology I'm using holding me back.

 

Another function that I am interested that isn't really a part of Google Forms is having one user's answers relate to anothers so that say if, using the above example, another user indicates they are a vegetarian and then in a follow-up question, indicate that they can not live with anyone that eats meat, that it is reflected in a compatibility summary.

 

So it's basically being able to post an almost unlimited number of questions to a website that are displayed in a very systematic fashion, and be able receive an almost unlimited number of submissions in the most easy, and economical way that I'm interested in.

 

I thought PHP, Apache, and MySQL would be a good choices because they are widely supported, open source and free. I was also thinking these would be easier to learn these than some of the other choices out there, or should be cheaper to pay someone else to set up if they so widely supported. I've also read that PHP is rarely used alone, and am unsure of what might compliment it well for what I'm wanting to use it for. Any advice?

Link to comment
Share on other sites

Oddly enough, I did click on the link "What does that term mean?" to reach Google, and started to type "Sessions" but thought the results I would get back would be a too ambiguous to be helpful as the word "sessions" has more than one meaning outside of a programming context, and although I am no expert, would suspect probably more than one meaning even within a programming context. Hence the idea of checking with the original source might be more helpful than a Google search in that particular case.

 

Although, I'll admit, I did find something on "pagination" through Google, which lead to what appeared to be a helpful Wikipedia article.

Link to comment
Share on other sites

Data Normalization: people tend to treat relational (notice that it's in italics) databases as Excel spreadsheets. That's exactly the wrong way to use them. The way to go is to normalize data so it can relate to itself/other data in a way that eliminates insertion and deletion headaches.

 

Sessions: HTTP is stateless, meaning there's nothing inherent in it that can remember things. Take this forum: it 'remembers' that you're logged in when you go from page to page. That remembrance is facilitated (in part) by sessions.

 

Pagination: Breaking long lists of items into manageable pages.

 

---

 

Data normalization is primarily a database concern, although it will affect how you write queries. Sessions are baked into PHP (and just about any other language that deals with HTTP on a regular basis) and are trivial to use, and can be modified a bit according to your needs. Pagination is really an algorithm. You'll use PHP to write it, but it's not dependent on PHP.

Link to comment
Share on other sites

Thanks for the feedback.

 

"Data normalization" is a topic I vaguely recall from having to set up simple databases in Access for school projects. "Sessions" and "pagination" were topics unfamiliar to me, perhaps because they are advanced topics not easily understood by newbies in terms of technical detail, but would seem easy enough to understand in terms of end user experience. (For example, I don't like how Facebook uses ajax to incrementally load up timelines, and search results because I have to wait after I've scrolled down as opposed to having what I want to see already there. And yes, it may save bandwidth, but on some sites, like on a simple quiz engine like site, I'm not sure that it really matters.)

Link to comment
Share on other sites

That dynamic loading of the timeline using AJAX has nothing to do with sessions, well.. Other than the fact that it uses a session to recognize your browser across the different requests, so that it knows what timeline to display.

 

The basic principle of sessions very simple: The server gives the client an ID, which the client uses for each request sent to the server. That way the server can identify the client, despite the protocol itself (HTTP) being stateless (each request are completely independent from the others).

Link to comment
Share on other sites

Oh... Ups. Sorry, I misunderstood. :-[

 

 

Thanks for the additional information on sessions though. I've generally thought of online sessions in terms of timeouts due to account inactivity. For example, you log into your bank account, walk away from your computer, and after a period of time the website automatically logs you out, except with my particular project, I'm thinking the aspect of sessions I need to be more so concerned about is how often is data saved.

 

The problem I had with Google forms is that if a user answers 100 of 100 questions, that it doesn't go through unless they hit the "submit" button at the very end of the form, signifying to me that Google Forms aren't really built for handling large numbers of questions. A more reasonable interval would be saving data at every ten or so questions. That way if there is some sort of interruption or the form isn't completely filled out for some reason, not everything is completely lost.

 

As for pagination, I'd imagine something simple should suffice where related questions are broken up into small, manageable batches with the goal of eliminating the need for scrolling, and having navigation by a simple "back" and "next" button on each screen of questions as opposed to page numbers. Such a set up would make ajax unnecessary I would think.

 

Whether or not these assumptions are correct, I guess I will find out when I get to learning more advanced topics such as "sessions" and "pagination" in depth. For now, after getting an overview of the types of tutorials that are out there, what it would seem like I need to pay particular attention to at a beginner's level are things like HTML and PHP Form handling, and setting up MySQL (which calls for a review of database normalization principles).

Link to comment
Share on other sites

From what I see, your assumptions are indeed quite correct. At least for your intended use. :)

 

Not only is it easier to save the progress under way when splitting the forum up in X pages of Y questions, but it'll also make it easier for those who're actually replying to said questionnaire.

Link to comment
Share on other sites

I don't want to put down what Jessica has recommended because they are valid topics to look up but Pagination itself is a fairly basic task that requires simple PHP syntax. I wouldn't research "pagination" but instead perhaps use it as a method for learning PHP, or rather basic programming skills. Try not to concentrate on learning how to write specific systems/tasks but instead use them to learn PHP syntax, basic control flow statements, loops etc so you can then apply it to any scenario.

 

Research programming control flow e.g. if statements; loops e.g. a for loop; arrays; what a constant is; classes and objects and much more. Choose a task, such as pagination, and try to do it using what you've found.

Edited by CPD
Link to comment
Share on other sites

Try not to concentrate on learning how to write specific systems/tasks but instead use them to learn PHP syntax, basic control flow statements, loops etc so you can then apply it to any scenario.

 

 

In the long run, I think having a general, well-rounded knowledge of web programming would be in my best interests if I wanted to maintain a website based upon it. However, my interest at the particular moment is in simply creating a bare bones development environment, where I focus minimally on programming at first as to work more on content development, and then once I have something I consider worth coding around, then focus on the web programming part.

 

Originally, I was using Google's drag and drop interface on Google Forms to create questionnaires. That seemed easy enough at first, and would allow me to preview how a form, or questionnaire would look once I was ready to launch it live. However, I soon learned that trying to create a large number of questions on Google Forms this is cumbersome at best, as the drag and drop interface will eventually freeze up, or not save new questions if there already are many. (Then there is of course the problem with users not always being able to complete a submission as well.)

 

That's when I considered just trying to develop content by typing questions and answer choices in a word processor program, but the problem I found with this is that word processor programs do not do a very good job of simulating the look and feel of a database driven website as to help better visualize how things look and work within one.

 

So that has brought me to the point of trying to learn just enough PHP to create a mock version of Google Forms with the intention of learning more as I go along. Currently, I have WAMP installed as to be able to run PHP code locally after viewing a PHP tutorial, and am in the process of getting acquainted with MyPHPAdmin.

 

I'm thinking on the most basic level, I need to know PHP syntax of course, then PHP and HTML form handling, then how to use PHP if statements with regard to the answer choices of some of the questions I'd want to ask, then maybe PHP arrays for posting a group of related questions that share the same answer choices (not sure about that one), and then how I want this information stored into MySQL. That, I'm hoping, should suffice for creating a bare bones development environment until I am ready to take things to the next level, and focus on more advanced topics such as those related to security, and other things, (where having a more developed and well-rounded knowledge of programming, I'd imagine probably comes quite in handy).

Link to comment
Share on other sites

You'll want to look into sessions as well, for storing the answers between page loads. Or, more specifically, identifying a user across multiple page views. ;)

 

 

Right, and I'm sure all that ties into membership logins with MySQL, of which I'm wondering if I could further simplify the set up of by copying a readily available membership script on the web, and by treating MySQL as a flat file with one table rather than an actual database with many tables and relationships - just for now. That, I'm thinking, would allow me to focus on the sequences of questions that I am interested in asking without getting too bogged down into technical details at first.

 

The idea behind the application is to continuously and systematically ask the end user as many questions as they will allow over time as to measure compatibility, and reveal insights that will help not only themselves, but also others in reaching desired relationship outcomes.

 

For example, if a guy's answers indicate that he "kicks puppies, and is mean to little kids", helpful feedback could be that 99% of female users on the system indicate finding this unacceptable, and that by changing his ways, he could improve his chances with women in general by a high margin. Perhaps a certain type of guy indicates interests in things like "BDSM", "Knife Play", and "Non-Consent", and a woman wonders why the guys she meets online come off as being like Jack the Ripper. It's probably because she's attracting the wrong type of guys, where the website could indicate that X % of the time this can be expected based upon the experiences other women have reported upon meeting a person with these types of interests. Similarly, to the guy that is into BDSM that wonders why said woman will not return his calls after giving her the scare of her life, it could be statistically pointed out that he may have greater success with women who not only share his particular interest in BDSM, but who are actually turned on by it. Another possibility is that a guy doesn't follow-up with a woman he's gone on a date with until two weeks later, and wonders why she doesn't return his call. Statistically it can be shown that that most women are going to be more high maintenance than that based on the answers other users have provided. This kind of thing is what I'd be interested in getting to a point where I can focus on before moving on to a more comprehensive study of programming if I can.

 

That being said, I'd imagine the single most common line of PHP code I'd be writing in this type of application would be IF statements since so much of it would be focused on sequences of questions.

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.