Ask an Internet Research Question
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?
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?
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.
There are a couple research specific books listed here that are great.... http://www.psychwiki.com/wiki/Internet_Research#Books_on_Online_Research
but none of them teach you php...for that, I'd recommend doing online tutorials more than getting a book. Do a google search for "php tutorial or try this website...
....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.
Can I test my code without a web server?
Ravi, I am in the process of learning PhP and MySQL, but have not yet purchased space on a web server that supports these programs. Is there anyway to test my PhP code and MySQL database without the webserver space? I am waiting on purchasing web space because I am unsure about a domain name, but still want to develop my script in the meantime. Thanks!
Yes, you can test scripts without web server space by installing Php, Apache, and MySQL on your local computer. It can be a bit daunting at first, but it's easier than it sounds. If you type 'install php mysql apache' into google, you'll get some windows installation FAQs (ie. http://www.php-mysql-tutorial.com/install-apache-php-mysql.php) As well, there is apparently (I've never tried it) a unified installation program for windows called WAMP5, which may make the process easier (http://www.wampserver.com/en/presentation.php).
After you've installed php/mysql/apache, you need to make sure they are running as services on your computer and then you should be able to open php files using a web browser's file->open command to open local files, just like you're opening a word document.
Good luck and let me know if you need further assistance.
◄ Back to Research Tools mainpage