From PsychWiki - A Collaborative Psychology Wiki

This page is being watched by Ravi Iyer, a php/mysql programmer/graduate student in Social Psychology, who built the technical parts of this website, in order to provide a forum for people to get help on the technical aspects of creating an internet survey in a way where the knowledge isn't lost. Simply edit this page by adding your question and Ravi promises to get back to you with an answer. Over time, we hope to accumulate a broad spectrum of questions/answers.

I want to start doing studies online, so do I need my OWN webpage for that, or can I put the study somehow on a webpage within my school’s official webpage?

This depends on your school. At USC, there is a lot of red tape and regulation of the school's official web resources (with good reason) such that it is much easier to find one own's hosting provider. Perhaps this seems like a daunting task, but in reality, your new hosting provider is likely to have tools that make your life easier. Most good hosting providers in the $10-20/month range will provide a control panel where you can create mysql databases, view statistics on your visitors, setup email accounts, and more. Make sure they provide the technology that you need for your study (typically php & mysql).

How do I get a domain name and hosting?

Domain names (ie. "psychwiki.com") are rented by the year and cost from $7-30 each year. Once you have a name, you can keep it and renew it for as many years as you wish. In addition to ".com", ".net", and ".org" domain names, you can buy names associated with a country (ie. ".uk" or ".in") from specialized registrars although there are rules for this.

You can use google to find a list of domain name registrars (ie. GoDaddy or Network Solutions), but most hosting companies will also sell you a domain name when you sign up with them. They'll take care of pointing the domain name to your hosting companies nameserver if you don't want to deal with it. This may sound complex, but it's simply a matter of putting in the right answer (your hosting company will tell you the value) in the right place when you register your domain name.

How do I get subjects for my studies?

It is human nature to assume that if we build something, people will realize our effort and utilize it, but unfortunately, on the internet, it takes work to get people to find your study. There is no one answer to this question and you may have to try a number of things before you find something that works for your study, depending on the subject matter and incentives you are offering. Try http://www.psychwiki.com/wiki/Internet_Research#Recruiting_Subjects for an ongoing discussion of subject recruitment.

What about diary (or multi-wave) studies?

Dear Ravi,

We have designed a diary study and would like to collect some data online. Our participants are supposed to fill out their first batch of questionnaires online on the first day, and come back to fill out additional questionnaire in a form of diaries everyday in a 14-day period. If they missed one day, the system should generate an automatic email to remind them of participation. Is there a good way to do that? Your help will be appreciated.

What you need is a "cronjob" which is a process which runs a script automatically. You'll need to create a script/page which checks the database for users which have not filled out a questionnaire and then mails them a reminder. The php function to send a mail to someone is documented here -> http://us3.php.net/function.mail.

Then, go to the control panel of your website (should be your web address + /cpanel) and there should be an option called cron jobs. There, you can setup a daily task to run your script. The only somewhat difficult thing is getting your pathnames for php correct. You can ask your hosting company for help with this, but your command to schedule will usually be something like "/usr/lib/php -q /home/USERNAME/scriptname" where USERNAME is the username you used to log into your control panel and /usr/lib/php is the path to php that your host company gives you.

How do I password protect my website if I want to restrict access?

The long answer involves creating a .htaccess file, placing it in the directory that you want to restrict access to, and using 'htpasswd' to create a username/password. More ingormation on that is here.... http://www.javascriptkit.com/howto/htaccess3.shtml

But if your web hosting account has a control panel (most do), you can actually do that from the control panel of your account using your ftp login and password to access the control panel (usually at the URL of your website plus /cpanel). Find the "web protect directories" or "web protect" option and the instructions should be fairly self explanatory (navigate to the directory, check the protect box, and create a username/password combination to access it).

Feel free to ask more questions if you need more detail or things clarified.

Programming Script - Perl vs. PHP

I am trying to figure out what programming script to use to be able to store info for my online studies. I was recommended Perl by someone who conducts studies online, but am not convinced it is the best way to go. Is there a reason you would recommend PhP over other similar types of script?

I recommend PHP because it's easier to learn. PHP is inserted within your html code. For example, you may have a page and want to print out the current date...you would simply add <? echo date('M-d-Y'); ?> at the appropriate page in your html page, rename it with a .php extension, and assuming that your webserver is configured correctly, you've just written a php program.

In contrast, Perl requires you to learn to write standalone scripts which output html. It can be embedded like php, but it isn't specialized for that purpose. Figuring out how to get your web server to run perl programs is a bit harder too....then again, I mainly do php myself so I'm biased. But I truly believe that php is the easier language to learn and it's becoming more and more the standard. If you aren't a programmer, you probably can do anything you want easier in php.

Perl is a fine language. It supposedly is more versatile than php, which is really specialized for web applications. But if you're building a web application, you probably don't care about how versatile your programming language is anyways. Less versatile = simpler...:)

Great, that is very useful to know.

Is there a book that you would recommend for learning PhP?

I have in general found it easy to find books that talk about web design and creation, but difficult to find anything tailored for the purposes we need. Thanks for your help.

....but I would skip the part about installing php/mysql/apache as you really should have a web host that already has that setup for you. So getting started should be as simple as renaming your pages from .html to .php and adding the snippets in the tutorial.