SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: forms

  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    0 Post(s)
    0 Thread(s)


    ok- I have read as many different posts as I can and tried searching the web in order to find what I was looking for. Unfortunately I was unable to find it.

    I am trying to create a form (a quiz to be exact) and I know how to create one in php. The only problem with this is that the location that I am planning on installing the quiz does not allow me php access, a cgi-bin or even internet access . Iam able to use html pages from a location stored on the desktop or in a network folder.

    My idea is to have the first page be the actual quiz with the users selecting the answers. The following page (whether its a popup, text file, or a new page) would be where the answers are displayed and then ultimately printed to paper. Most of the scripts that I have found that would do something similar are email style scripts (I am unable to use this method)

    This is what I have in php and is the type of format I am looking for in javascript. (I'm not very proficient in php as I just started and I have no clue about javascript)

    *******Page 1********

    <form action="welcome.php" method="POST"><br>
    Enter your name: <input type="text" name="name" /><br>
    <br /><br>
    Enter your homeroom: <input type="text" name="homeroom"

    1) What is the first letter of the alphabet? <br /><br>
    <form action="welcome.php" method="POST">
    <input type="radio" name="q1" value="A" />A. <br /><br>
    <form action="welcome.php" method="POST">
    <input type="radio" name="q1" value="B"/>B. <br /><br>
    <form action="welcome.php" method="POST">
    <input type="radio" name="q1" value="C"/>C. <br /><br>

    2) What is the difference between a jungle and a rain forest? <br /><br>
    <form action="welcome.php" method="POST">
    <input type="radio" name="q2" value="A" />A. No Difference.<br /><br>
    <form action="welcome.php" method="POST">
    <input type="radio" name="q2" value="B"/>B. Less rain than a rain forest.<br /><br>
    <form action="welcome.php" method="POST">
    <input type="radio" name="q2" value="C"/>C. Thickest area of a rain forest.<br /><br>
    *********Page 2*********


    Welcome <?php echo $_POST["name"]; ?>.<br />
    Your homeroom is <?php echo $_POST["homeroom"]; ?>.<br />
    <br />
    1. <?php echo $_POST["q1"]; ?>.<br />
    2. <?php echo $_POST["q2"]; ?>.<br />


    This is just a sample using 2 questions and 2 answers, but I would like to create more questions in a simple format so that I can have someone with less computer experience be able to update the files.

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2004
    0 Post(s)
    0 Thread(s)
    Well you should look into a way to get the querystring in javascript.

    1. Submit the form to another page, using the GET protocol, this send the variables in the querystring.
    2. in the second page, read the querystring and parse it, probably something like:

    function read_querystring(){
     theQuerystring =;
     theVariables = split("&", theQuerystring) // array containing the query variables
      newVariable = split("=", theVariables[i]);
      newSpan = document.createElement("SPAN");
      newSpan.innerHTML = newVariable[0]+" = "+newVariable[1];
    probably now exactly what you were looking for, but just showing the principle.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts