1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Its me again Can you set a cookie to any type of form, ie: add it up form

Discussion in 'Software Development' started by scootertiki, Nov 13, 2001.

Thread Status:
Not open for further replies.
Advertisement
  1. scootertiki

    scootertiki Thread Starter

    Joined:
    Oct 10, 2001
    Messages:
    38
    Hey I am still having trouble taking info from a form to a printable page. Now I want to take the simple add it up form that I have and transfer all the items they add up and the total to a printable page. Are cookies the way to go. Should I set a cookie and retrieve it, and how do I set a cookie to the javascript that calculates my total?

    Here is my add up form.<FORM NAME="MyForm">
    P>Size<SELECT NAME="size" SIZE="1" ONCHANGE="totalPrice()">
    OPTION VALUE="0" SELECTED="SELECTED">-- Select --/OPTION><OPTION
    VALUE="2400">4' x 4'</OPTION><OPTION VALUE="3550">4' x 6'/OPTION><OPTION VALUE="4125">4' x 8'</OPTION><OPTION VALUE-"4700">6' x 6'</OPTION>
    OPTION VALUE="6300">8' x 8'</OPTION><OPTION VALUE="7900">8' x 12'</OPTION></SELECT>
    /P>
    P>Ceiling Height-(at least 8'?)<SELECT NAME="ceiling" SIZE="1" ONCHANGE="totalPrice()">
    OPTION VALUE="0" SELECTED="SELECTED">-- Select --/OPTION><OPTION
    VALUE="0">Yes</OPTION><OPTION VALUE="0">No</OPTION></SELECT>
    /P>
    P>Door Hinge <SELECT NAME="hinge" SIZE="1" ONCHANGE="totalPrice()">
    OPTION VALUE="0" SELECTED="SELECTED">-- Select --/OPTION><OPTION
    VALUE="0">Left</OPTION><OPTION VALUE="0">Right</OPTION></SELECT>
    /P>
    P>1' x 2' Door Window<SELECT NAME="window" SIZE="1" ONCHANGE="totalPrice()">
    OPTION VALUE="0" SELECTED="SELECTED">-- Select --/OPTION><OPTION
    VALUE="0">Yes</OPTION><OPTION VALUE="56">Exchange for 3' x 3'</OPTION><OPTION VALUE="280">Door window & 3' x 3'</OPTION></SELECT>
    /P>
    P>Caster Wheels <SELECT NAME="wheels" SIZE="1" ONCHANGE="totalPrice()">
    OPTION VALUE="0" SELECTED="SELECTED">-- Select --/OPTION><OPTION
    VALUE="0">No</OPTION><OPTION VALUE="200">Yes</OPTION></SELECT>
    /P>
    P>Sub Floor Foam<SELECT NAME="subfloor" SIZE="1" ONCHANGE="totalPrice()">
    OPTION VALUE="0" SELECTED="SELECTED">-- Select --/OPTION><OPTION
    VALUE="0">Yes</OPTION><OPTION VALUE="0">No</OPTION></SELECT>
    /P>
    P>Ventilation System<SELECT NAME="vent" SIZE="1" ONCHANGE="totalPrice()">
    OPTION VALUE="0" SELECTED="SELECTED">-- Select --/OPTION><OPTION
    VALUE="0">Yes</OPTION><OPTION VALUE="0">No</OPTION></SELECT>
    /P>
    P>Vent Fan Size<SELECT NAME="fan" SIZE="1" ONCHANGE="totalPrice()">
    OPTION VALUE="0" SELECTED="SELECTED">-- Select --/OPTION><OPTION
    VALUE="0">Recording</OPTION><OPTION VALUE="0">Practicing</OPTION></SELECT>
    /P>
    P>Fluorescent Light<SELECT NAME="light" SIZE="1" ONCHANGE="totalPrice()">
    OPTION VALUE="0" SELECTED="SELECTED">-- Select --/OPTION><OPTION
    VALUE="0">Yes</OPTION><OPTION VALUE="0">No</OPTION></SELECT>
    /P>
    Total Price<INPUT TYPE="TEXT" NAME="total">
    /P>
    /FORM>
    SCRIPT LANGUAGE="JavaScript"
    var price1 = 0 ;
    var price2 = 0 ;
    var price3 = 0 ;
    var price4 = 0 ;
    var price5 = 0 ;
    var price6 = 0 ;
    var price7 = 0 ;
    var price8 = 0 ;
    var price9 = 0 ;
    var price10 = 0 ;
    var price11 = 0 ;
    var price12 = 0 ;
    var price13 = 0 ;
    var price14 = 0 ;
    var totalprice = 0 ;

    function totalPrice() {
    price1 = parseInt (document.MyForm.size.value );
    price2 = parseInt (document.MyForm.ceiling.value );
    price3 = parseInt (document.MyForm.hinge.value );
    price4 = parseInt (document.MyForm.window.value );
    price5 = parseInt (document.MyForm.wheels.value );
    price6 = parseInt (document.MyForm.subfloor.value );
    price7 = parseInt (document.MyForm.vent.value );
    price8 = parseInt (document.MyForm.fan.value );
    price9 = parseInt (document.MyForm.light.value ); totalprice = price1 + price2 + price3 + price4 + price5 + price6 + price7 + price8 + price9
    document.MyForm.total.value = totalprice

    Any suggestions?? I am pulling my hair out over this one!



    :confused:
     
  2. ClassyLinks

    ClassyLinks

    Joined:
    Aug 12, 2001
    Messages:
    213
    What scripting languages can you use on your server?


    If you can use ASP is is a simple matter of (on your target page - saved with the .asp extension) calling the value like this:

    Code:
    &lt;%= request.form("total price")%&gt;
     
  3. scootertiki

    scootertiki Thread Starter

    Joined:
    Oct 10, 2001
    Messages:
    38
    My server only supports apache asp, and perl5 and php5 i believe.
    I dont know anything about apache asp. I definitely in between a rock and a hard place. What I am trying to do, seems fairly simple, but I have yet to get a workable solution.

    Thanks,
    Liz
     
  4. ClassyLinks

    ClassyLinks

    Joined:
    Aug 12, 2001
    Messages:
    213
    apache asp should be the same as other asp.

    did you try my suggestion??
     
  5. scootertiki

    scootertiki Thread Starter

    Joined:
    Oct 10, 2001
    Messages:
    38
    im not so sure about that, because my host said that i must understand that apache asp is not the same as microsoft asp.

    But, to try your suggestion, would I need to put anything else on the additup page? How would i link them?? Sorry, just i dont understand the steps.

    Thanks,
    Liz
     
  6. ClassyLinks

    ClassyLinks

    Joined:
    Aug 12, 2001
    Messages:
    213
    have your form action point to "test.asp".


    Code:
    &lt;form method="post" action="test.asp"&gt;
    your form goes here
    &lt;/form&gt;
    Then... in test.asp try this to see if it works:

    Code:
    &lt%=request.form("oneofyourformfieldnamesgoeshere")%&gt;
    If it works, you should see the value printed out when you call the test.asp page from the browser.

    I checked a site about apache asp and I see that it basically runs perl scripts inside the asp tags. I know nothing about Perl....so it this doesn't work I'm out of my league!

    But this link might help:

    http://asp.startcom.org/eg/response.asp
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/58450

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice