Create Sequential number / Text file read-write...

Discussion in 'HTML' started by Rhonda, Sep 14, 2005.

  1. Rhonda

    Rhonda Guest

    Hi

    I'm trying to create a sequential order number in simple web-based order
    forms, that have no DB back ends. It just emails the order for now.

    Is there a simple way to Read a number from a Text File on my web server,
    increment it by +1, then re-save/update that text file? There must be.

    I have scoured the HTML and JavaScript sites finding nothing.

    Any suggestion?

    Thank you all.
     
    Rhonda, Sep 14, 2005
    #1
    1. Advertising

  2. Rhonda

    Oli Filth Guest

    Rhonda said the following on 14/09/2005 18:09:
    > Hi
    >
    > I'm trying to create a sequential order number in simple web-based order
    > forms, that have no DB back ends. It just emails the order for now.
    >
    > Is there a simple way to Read a number from a Text File on my web server,
    > increment it by +1, then re-save/update that text file? There must be.
    >
    > I have scoured the HTML and JavaScript sites finding nothing.
    >


    Well, that would be because it has nothing to do with HTML or Javscript.
    You need to use server-side stuff, like PHP, ASP, or Perl.

    --
    Oli
     
    Oli Filth, Sep 14, 2005
    #2
    1. Advertising

  3. Rhonda

    Rhonda Guest

    Thank you.
    That must be a difficult request then.

    "Oli Filth" <> wrote in message
    news:L7ZVe.6797$...
    > Rhonda said the following on 14/09/2005 18:09:
    > > Hi
    > >
    > > I'm trying to create a sequential order number in simple web-based order
    > > forms, that have no DB back ends. It just emails the order for now.
    > >
    > > Is there a simple way to Read a number from a Text File on my web

    server,
    > > increment it by +1, then re-save/update that text file? There must be.
    > >
    > > I have scoured the HTML and JavaScript sites finding nothing.
    > >

    >
    > Well, that would be because it has nothing to do with HTML or Javscript.
    > You need to use server-side stuff, like PHP, ASP, or Perl.
    >
    > --
    > Oli
     
    Rhonda, Sep 15, 2005
    #3
  4. Rhonda wrote:

    > Thank you.


    Rhonda: First don't write your reply *above* what you are replying to,
    that is called *top-posting*, a no-no in the group.

    > That must be a difficult request then.


    Nothing difficult all.

    >>Well, that would be because it has nothing to do with HTML or Javscript.
    >>You need to use server-side stuff, like PHP, ASP, or Perl.


    Oli is telling you the truth, what you wish reading and writing to your
    server cannot be done with either HTML or client-side JavaScript. You
    have to use scripting the runs on your server...like PHP, ASP, Perl...

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Sep 15, 2005
    #4
  5. Rhonda

    Rhonda Guest

    "Jonathan N. Little" <> wrote in message
    news:444We.1105$...
    > Rhonda wrote:
    >
    > > Thank you.

    >
    > Rhonda: First don't write your reply *above* what you are replying to,
    > that is called *top-posting*, a no-no in the group.
    >
    > > That must be a difficult request then.

    >
    > Nothing difficult all.
    >
    > >>Well, that would be because it has nothing to do with HTML or Javscript.
    > >>You need to use server-side stuff, like PHP, ASP, or Perl.

    >
    > Oli is telling you the truth, what you wish reading and writing to your
    > server cannot be done with either HTML or client-side JavaScript. You
    > have to use scripting the runs on your server...like PHP, ASP, Perl...
    >
    > --
    > Take care,
    >
    > Jonathan
    > -------------------
    > LITTLE WORKS STUDIO
    > http://www.LittleWorksStudio.com


    Ok

    I'm looking at various simple PHP counter scripts, that can double for my
    unique order number.
     
    Rhonda, Sep 15, 2005
    #5
  6. Rhonda

    Rhonda Guest

    SOLVED!!! Re: Create Sequential number / Text file read-write...

    "Rhonda" <> wrote in message
    news:wE4We.2985$...
    >
    > "Jonathan N. Little" <> wrote in message
    > news:444We.1105$...
    > > Rhonda wrote:
    > >
    > > > Thank you.

    > >
    > > Rhonda: First don't write your reply *above* what you are replying to,
    > > that is called *top-posting*, a no-no in the group.
    > >
    > > > That must be a difficult request then.

    > >
    > > Nothing difficult all.
    > >
    > > >>Well, that would be because it has nothing to do with HTML or

    Javscript.
    > > >>You need to use server-side stuff, like PHP, ASP, or Perl.

    > >
    > > Oli is telling you the truth, what you wish reading and writing to your
    > > server cannot be done with either HTML or client-side JavaScript. You
    > > have to use scripting the runs on your server...like PHP, ASP, Perl...
    > >
    > > --
    > > Take care,
    > >
    > > Jonathan
    > > -------------------
    > > LITTLE WORKS STUDIO
    > > http://www.LittleWorksStudio.com

    >
    > Ok
    >
    > I'm looking at various simple PHP counter scripts, that can double for my
    > unique order number.
    >

    I solved my problem!

    How's this look? It works perfect. try it.
    -----------------------------------------------
    <html> <!-- O R D E R N U M B E R G E N E R A T O R -->
    <head>
    <title>Order Number generator</title> </head>

    <body onload="GenerateOrderNumber(); document.ordnum.ordernumber.value =
    GenerateOrderNumber();

    document.ordnum.startingdate.value = generateTodaysDate(); " background="">

    <form name="ordnum">
    <div align="center">
    <tr>
    <td width="155"><font face="Verdana" size="2">Order
    Number:</font></td>
    <input maxLength=15 size=15 name="ordernumber" ></font></td>

    <td width="155"><font face="Verdana" size="2">Order Date:</font></td>
    <input maxLength=15 size=15 name="startingdate"></font></td>
    </tr>
    </div>
    </form>
    </body>
    </html>

    <SCRIPT language="javascript">
    function GenerateOrderNumber()
    { tmToday = new Date();
    return tmToday.getTime(); }
    function generateTodaysDate()
    { var d = new Date();
    var startingdate = new String((d.getMonth() + 1) + "/" + d.getDate() +
    "/" + d.getFullYear()); return

    startingdate; }
    </SCRIPT>
     
    Rhonda, Sep 17, 2005
    #6
  7. Re: SOLVED!!! Re: Create Sequential number / Text file read-write...

    In article <AZIWe.9281$>,
    "Rhonda" <> wrote:
    > >
    > > I'm looking at various simple PHP counter scripts, that can double for my
    > > unique order number.
    > >

    > I solved my problem!
    >
    > How's this look? It works perfect. try it.
    > -----------------------------------------------
    > <html> <!-- O R D E R N U M B E R G E N E R A T O R -->
    > <head>
    > <title>Order Number generator</title> </head>
    >
    > <body onload="GenerateOrderNumber(); document.ordnum.ordernumber.value =
    > GenerateOrderNumber();


    [snip]
    >
    > <SCRIPT language="javascript">
    > function GenerateOrderNumber()
    > { tmToday = new Date();
    > return tmToday.getTime(); }


    Rhonda, I don't mean to discourage you, but it's important to recognize
    two short-comings of this approach:
    1) Visitors who don't have JavaScript may not be able to place orders.
    2) Sooner or later (but certainly sooner than expected) two visitors
    will load the page at the same time (according to Date()), and you will
    receive more than one order with the same order number.

    Now, you may not be concerned about lost orders due to #1, and you may
    figure you can use other information (names, addresses, etc.) to deal
    with #2: in that case, go well.

    However, if you are concerned about either of those problems (or when
    the day comes that the pain from either is too much), then you'd be much
    better served by using a transactional database to generate sequential
    numbers. Your customers wouldn't need to support any special
    functionality to place orders, and transactions would guarantee that you
    would not generate two identical numbers (or nearly so: there are
    certain edge cases).

    You might also consider transforming the sequence number somehow, so
    that folks can't tell whether you've taken 2 orders in the last month or
    2000, just by looking at the order number. Again, you might not care,
    but in some cases it's important.

    Have fun. Order numbers are less trivial than they appear, especially if
    you need a lot of 'em.

    --
    Joel.
     
    Joel Shepherd, Sep 17, 2005
    #7
  8. Rhonda

    Rhonda Guest

    Re: SOLVED!!! Re: Create Sequential number / Text file read-write...

    "Joel Shepherd" <> wrote in message
    news:...
    > In article <AZIWe.9281$>,
    > "Rhonda" <> wrote:
    > > >
    > > > I'm looking at various simple PHP counter scripts, that can double for

    my
    > > > unique order number.
    > > >

    > > I solved my problem!
    > >
    > > How's this look? It works perfect. try it.
    > > -----------------------------------------------
    > > <html> <!-- O R D E R N U M B E R G E N E R A T O R -->
    > > <head>
    > > <title>Order Number generator</title> </head>
    > >
    > > <body onload="GenerateOrderNumber(); document.ordnum.ordernumber.value =
    > > GenerateOrderNumber();

    >
    > [snip]
    > >
    > > <SCRIPT language="javascript">
    > > function GenerateOrderNumber()
    > > { tmToday = new Date();
    > > return tmToday.getTime(); }

    >
    > Rhonda, I don't mean to discourage you, but it's important to recognize
    > two short-comings of this approach:
    > 1) Visitors who don't have JavaScript may not be able to place orders.
    > 2) Sooner or later (but certainly sooner than expected) two visitors
    > will load the page at the same time (according to Date()), and you will
    > receive more than one order with the same order number.
    >
    > Now, you may not be concerned about lost orders due to #1, and you may
    > figure you can use other information (names, addresses, etc.) to deal
    > with #2: in that case, go well.
    >
    > However, if you are concerned about either of those problems (or when
    > the day comes that the pain from either is too much), then you'd be much
    > better served by using a transactional database to generate sequential
    > numbers. Your customers wouldn't need to support any special
    > functionality to place orders, and transactions would guarantee that you
    > would not generate two identical numbers (or nearly so: there are
    > certain edge cases).
    >
    > You might also consider transforming the sequence number somehow, so
    > that folks can't tell whether you've taken 2 orders in the last month or
    > 2000, just by looking at the order number. Again, you might not care,
    > but in some cases it's important.
    >
    > Have fun. Order numbers are less trivial than they appear, especially if
    > you need a lot of 'em.
    >
    > --
    > Joel.



    I know of that shortcoming, but it will suffice until I learn enough about
    MySQL to take that step.

    Thanks
     
    Rhonda, Sep 17, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Albert Tu
    Replies:
    3
    Views:
    554
    Bengt Richter
    Mar 10, 2005
  2. JL
    Replies:
    2
    Views:
    122
    Tim Chase
    Dec 14, 2013
  3. Cameron Simpson
    Replies:
    0
    Views:
    96
    Cameron Simpson
    Dec 15, 2013
  4. Chris Angelico
    Replies:
    0
    Views:
    103
    Chris Angelico
    Dec 15, 2013
  5. Tim Chase
    Replies:
    0
    Views:
    108
    Tim Chase
    Dec 16, 2013
Loading...

Share This Page