View Full Version : HTML Form/Survey copying help

10-24-2011, 09:21 PM
Hello Everyone,

I am relatively new to webcoding, and find myself in need of help with a question about a form/survey that I am coding by hand (as opposed to using SurveyMonkey or similar).

I am making a survey for a student at my University who is doing research on memories. On the first page of the survey, people fill in a textbox with a memory that they have, and a drop down list of how old they were when the event in the memory occurred. On the next page, I want page 2 to pull the event from the textbox on the first page and place it on the page, then there are a series of ranked questions that people answer about the event, and then they enter the age they were when it occurred again. What code would I need to input to get that information to be copied from the first page, to the second page? As well, page 2 will be the additional information about the first event. Page 3 would be the additional information about the 2nd event listed on the first page, page 4 would be the information for the 3rd event listed on the first page, etc... Does that make sense?

Thanks for your time! I really appreciate the help!

10-25-2011, 03:22 PM
You would need html/css to create your page using the form tags. When submitted your need php or something similar to receive that information and insert it into the next page. You would also want php to store your information in a database.

It's a lot to learn, but doable. see http://www.w3schools.com/

10-25-2011, 07:36 PM
Thanks Sunfighter

The thing is, I already know that I need all of those things but I cannot figure out how to combine them into what I need, which is why I was asking. I have tried lots of different things, but as I don't know the terminology well enough to ask for what I need on Google or similar I came here to see if others would be able to help.

Can anyone tell me WHAT code I need to do this?

10-29-2011, 10:51 PM
If your still with us ersatz I give you an example.
Lets say you have a database named 'superheros' in which you store the name of a super hero and his secret identity first name and last name.
You make a page asking if the user wants to see batman's first or second name.
When the user picks, your page activates a portion of the page that is called javascript(JS). Js allows the browser to act like a separate program and will call a follow up script on the server with an extinction of .php This is a program that runs on the server that will query your database and find batman's first name. It then writes a html page and inserts the name into it and sends it to your browser so you can see the answer.

The php script IS the same as an HTML page that you would have called with a 'next' button, but it does more the that type of script can do. If you have a database or know how to set one up, the php can write to it or retrieve from it. PHP can also write your html page and since it is a language it can use variable in the page that will be replaced by data the php script found.

Does this make any since?

AN HTML script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>New document</title>
<meta name="generator" content="TSW WebCoder 2010" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<form id="myform" action="test.php" method="post">
<input type="hidden" name="evilIE" value="junk" />
What is your first name?<input type="text" name="name" onblur="submit();" /><br />

The php script that it called
if ($_POST['evilIE'] == "junk"){
echo 'Hello '.$_POST["name"];
?>See how the variable $_POST["name"] can be replaced with anything?