/    Sign up×
Community /Pin to ProfileBookmark

total cost before submitting

Hi

I just tried posting in the PHP section but this might require some javascripting instead

I know there are already many travel agency sites and computer sites that uses this kind of solution when booking a trip or building an own computer with selected items. I would like to create basically the same thing.

I have a form already which can be sent to my mail using PHP but the main Form page is a simply htm source.

I would like it when I select a few options a total sum will then be visible before submitting the form

It would be better to press another button before the submitt button to see the total sum.

Got any good ideas and/or smart solutions?

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@SiddanauthorMar 02.2005 — big amount of flow over here.. already ended up at page three after 2 days lol
Copy linkTweet thisAlerts:
@Warren86Mar 02.2005 — Siddan:

It would help if you posted your form, or relevant parts of it, and explained exactly what the problem is.
Copy linkTweet thisAlerts:
@SiddanauthorMar 03.2005 — Well it is not really a problem, just trying to find a solution of addng 1+1 ? This could reduce lots of work and effort for future being.

In a very simple form, like a list form where there are some amount of option values. I would like each value to have a number which is represented how much it costs. There could be 3 or 4 of these lists. After the selection is done, a button could calculate the total sum

Produkt Alpha:
[list]
  • apple

    peer

    banana

    lemmon
  • [/list]


    Produkt Beta:
    [list]
  • bag

    purse

    bowl

    plate
  • [/list]


    Shipment:
    [list]
  • Area 1

    Area 2

    Area 3

    Area 4
  • [/list]


    Each option value have a hidden number which will then add up to a total sum

    And a everyone knows how a list form looks like ?

    But is javasript solution well suited for this due to the accesibility. I have tried asking for the same help in the PHP board
    Copy linkTweet thisAlerts:
    @SiddanauthorMar 03.2005 — ok, that example didn´t seem to inspire anyone to help me with ?

    So I made this effort of creating some sample pages along with a script I have found. But this script needs a bit of tweaking to suit my needs and it is here where I am stuck but generally this is what it [URL=http://www.eurorider.se/TestBook/]should look like[/URL] .....

    Notice on the first page when selecting a radio button, the total Cost will change accordingly to the ( value ) next by the radio button. So far this is working well but there are 2 things which troubles me....

    1). I would rather not to use the hotels twice, by road and by air. But rather using another 2 radio buttons which you can chose by road or by air instead. So wether you have selected By Road or By Air it would then affect the Hotel prices.

    2). Since that javascript is already occupying Value and Name in the forms I can´t use those later in the next comming page where I want to use a php string to include those values, that would be the hardest to achieve perhaps.

    Or are there any other nice soluions for this structure?

    please help, kinda desperate :p
    Copy linkTweet thisAlerts:
    @SiddanauthorMar 04.2005 — ok, sorry. Getting desperate now so I guess I have to cut down my demands and will only ask for one thing....

    is it possible by javascript or whatever to display the selected items on the next page ... link is on the previous post
    Copy linkTweet thisAlerts:
    @SiddanauthorMar 08.2005 — *bump*

    are the details still not enough?... have to know so I don´t have to think everyone ignores this post just cus it seems too complicated byt glancing inside this thread
    Copy linkTweet thisAlerts:
    @DeadlyPersonaAug 24.2007 — Siddan did you ever get your question answered or resolved? I'm having a similar issue and I could use as much help as possible?
    Copy linkTweet thisAlerts:
    @Mr_MooAug 24.2007 — The original question was posted a little over 2 years ago. Umm, can you provide some more detail as to what it is you want to do? Maybe some source or a link?
    Copy linkTweet thisAlerts:
    @DeadlyPersonaAug 24.2007 — Ok I think it will be easier to explain by showing you an example. I found this code at www.developingwebs.net.

    I saved the first code as index.html and the other code as orderprocessing.php.html Is that correct?

    Anyway, I need to know how to connect the two pages to where when digits are entered in the index.html fields and I click submit order it will then bring up the orderprocessing page that shows what was order. If I can get an understanding of how these two codes are supposed to interact, I will be able to adjust the code to my liking and be able to use it. I previously installed Apache and PHP software but was told that should be uninstalled and I should use XAMPP. I don't know how though. ?

    [B][U]INDEX.HTML CODE HERE[/U][/B]

    <HTML>

    <HEAD>

    <TITLE>

    </TITLE>

    </HEAD>

    <BODY>

    <H1>Bob's Auto Parts</H1>

    <H2>OrderForm</H2>

    <FORM action="processorder.php" methond=post>

    <TABLE border=0>

    <TR>

    <TD BGCOLOR="#CCCCCC">Item</TD>

    <TD BGCOLOR="#CCCCCC">Quantity</TD>

    </TR>

    <TR>

    <TD>Tires</TD>

    <TD align="center"><INPUT type="text" name="tireqty" size=3 maxlength=3</TD>

    </TR>

    <TR>

    <TD>Oil</TD>

    <TD align="center"><INPUT type="text" name="oilqty" size=3 maxlength=3></TD>

    </TR>

    <TR>

    <TD>Spark Plugs</TD>

    <TD align="center"><INPUT type="text" name="sparkplugqty" size=3 maxlenth=3></TD>

    </TR>

    </TABLE>

    <input type=submit value="Submit Order">

    </FORM>

    </BODY>

    </HTML>


    [B][U]ORDERPROCESSING.PHP.HTML - CODE HERE[/U][/B]

    <HTML>

    <HEAD><TITLE>Bob's Auto Parts - Order Results</TITLE>

    </HEAD>

    <BODY>

    <H1>Bob's Auto Parts</H1>

    <H2>Order Results</H2>

    <?

    echo "<P>Order Processed";

    echo date("Hi, jS F");

    echo "<br>";

    echo $tireqty." tires<BR>";

    echo $oilqty." bottles of oil<BR>";

    echo $sparkplugqty." spark plugs<BR>";

    $totalqty = 0;

    $totalamount=0.00;

    define("TIREPRICE",100);

    define("OILPRICE",10);

    define("SPARKPLUGPRICE",4);

    $totalqty = $tireqty + $oilqty + $sparkplugqty;

    $totalamount = $tireqty * TIREPRICE

    + $oilqty *
    OILPRICE

    + $sparkplugqty * SPARKPLUGPRICE;

    $totalamount=number_format($totalamount,2);

    echo "<BR>n";

    echo "Items ordered: ".$totalqty."<BR>n;

    echo "Subtotal: ".$totalamount."<BR>"n;

    $taxrate = 0.10; //local sales tax is 10% here

    $totalamount = number_format($totalamount,2);

    echo "total Including Tax: $".$totalamount."<BR>n";

    ?>

    </BODY>

    </HTML>
    Copy linkTweet thisAlerts:
    @Mr_MooAug 24.2007 — Ahh. I think you will find that the PHP guys can help you out with that. What you want is not JavaScript.
    ×

    Success!

    Help @Siddan spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.29,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...