PDA

View Full Version : Order Number on Web Form



no1uno
Jan 9th, 2007, 01:10 AM
Hi all

I am new here, so I apologise if I am in the wrong area.

Could someone please help me with a web form.
Creating the form hasn't been to hard considering I'm still learning. What I need is to be able to add a order number on the web form each time a user fills it out. The order numbers can either be consecutive or random. It will need to be added to the email that is sent to the user and to the webmaster.

Any help with this would be greatly appreciated.

Thanks.

Troy297
Jan 9th, 2007, 01:42 AM
First of all Welcome To CF!

Um.... what you would need is a hidden field that generates a series of consecutive numbers based upon form submissions, if it was just random you could possibly end up with the same one twice....

You would need to use something that is the HTML equivelant to the MySQL ID field... although not sure how... likely using Javascript.

And just a question but why would you need an order number if the form is just sent to you? It would make sense if you are storing the orders in a database but not in email formart?

And sorry I dont know how to do what you need.... :(

no1uno
Jan 9th, 2007, 02:27 AM
Thanks for your response Troy.


Um.... what you would need is a hidden field that generates a series of consecutive numbers based upon form submissions, if it was just random you could possibly end up with the same one twice....
This wouldn't matter too much as it wouldn't be an overly used form.


And just a question but why would you need an order number if the form is just sent to you? It would make sense if you are storing the orders in a database but not in email formart?
The form will be used to place an order at seafood store for pick up. The order number would be used in the email sent to the user and to the customer service person at the store. The client would quote the order number on collection.

felgall
Jan 9th, 2007, 02:35 AM
You could use either Javascript or a server side language to get the current date/time. This is normally stored internally as the number of seconds or milliseconds since 1st Jan 1970. If you retrieve the value in that format you can either use it as is for your unique order number or if the value is too big then just subtract a fixed amount from it to bring it down to an acceptable size.

Troy297
Jan 9th, 2007, 02:42 AM
Well.... you would firstly need to make your page .php, then use your typical html form but add one field that looks like:


<input type="hidden" name="odernum" value="<?php srand((double)microtime()*1000000);
echo rand(0,1000000);?>">

You likely could have found this yourself by using google. Just so you know for next time!

no1uno
Jan 9th, 2007, 09:48 AM
You could use either Javascript or a server side language to get the current date/time. This is normally stored internally as the number of seconds or milliseconds since 1st Jan 1970. If you retrieve the value in that format you can either use it as is for your unique order number or if the value is too big then just subtract a fixed amount from it to bring it down to an acceptable size.

Hi FELGALL

I like this idea, it seems to be simplest way. I did give this a go but the format was wrong. The webform I am using was created using a webform maker, the email that is sent to the webmaster is in HTML. Below is a snippet of what it looks like.


Retail Order Form From Website
Date Sent : January 9, 2007 | Time Sent : 18:33

Order No : 18:33January 9, 2007

This the code:

<td width="97%">
<p align="center"><b><font face="Trebuchet MS" size="4">Retail Order Form
From Website </font><font face="Trebuchet MS">&nbsp;</font></b><font face="Trebuchet MS" size="2"><b><br>
Date Sent : </b>{'DATE'}<b>&nbsp; <font color="#FF0000">|</font> Time Sent : </b>
{'TIME'}</font><p align="center"><font face="Times New Roman" size="5"><b>
Order No: </b></font><font face="Times New Roman" size="4">{'TIME'}{'DATE'}</font></td>

As you can see the date format is January 9, 2007. This needs to be 070109.
And the time needs to be 1833. Then the order number would look like 0701091833.

Thanks

rmedek
Jan 9th, 2007, 04:50 PM
What language is the webform maker code written in? You could use that language to format {TIME} and {DATE} before showing the output.