Building the Recordset for an HTML Database Form - Maximum Number of Records a Web Page Can Have
(Page 4 of 4 )
From my experience, the latest popular browsers can handle at least 1000 records (TR elements). These are more than enough records for a user to go through on a shopping web page. You should avoid having more than 100 records (or even 50) for a shopping page. If you want more than that, then I will show you how to do it in a way that will not be boring to the user, in a later series.
Who Should Use This Web Page?
The ordinary Internet user or the database administrator can use the web page.
You should send the web page to the ordinary Internet user without the buttons to add, edit, save etc. The only buttons you can send with his web page are the Sort and Done buttons. Of course he should have the "Add to Cart" button for each record and some means to send the information in his shopping cart to the server.
Now you may think that the user can manipulate the form internally and send information that he has bought a higher-priced watch for a lower price. This must not be permitted, and you should take steps to make certain that it is not possible. You should arrange things such that each record has an ID, and the main information sent by the user should be the ID and number of a particular watch purchased. At the server you have a copy of all the data for a particular ID.
Everything that I am describing -- the steps that need to be taken -- applies to the database administrator.
Shopping Cart
I have not written any code for the shopping cart, but I have indicated where you can have it. Concerning the shopping cart, the whole setup I have created has an advantage over other web pages with shopping carts. With other web pages you may have to scroll up and down to see your shopping cart or your shopping cart may be opened in another window. Here your shopping cart appears next to what you are buying. This is because you scroll through the form to buy and not through the page.
The Form's enctype Attribute
The HTML Form element has an attribute called enctype. This attribute indicates the kind of data in your form. The default value for this attribute is "application/x-www-form-urlencoded." This works only when you are dealing with text data. If this is what you want, you can omit the attribute from your Form element. When you have File Input Controls (links to images) you should not omit this attribute. Its value has to be "multipart/form-data."
The Look of the Web Page
You can modify your web page in many different ways; feel free to use the techniques with which you are familiar. I have given you the essentials. You can reduce the size of the records and hence the size of the tabular form, but do not reduce them too much.
Coding
I think I talked a lot about coding in the previous parts of this series. I will say very little here.
Note that the controls in the recordset are controls that can be transmitted automatically by the actual form. So the code that copies the recordset information to the transmitted table can copy only the controls. The controls have been given IDs to facilitate this.
The code that does the sorting should compare the text of the controls and not the controls themselves.
Downloading Time
Since the web page has a large amount of text, images and JavaScript code, you are probably asking yourself if the download time will be too long. Remember, at the beginning of this article, I said that we are dealing with a small database. If your database is small, everything will be fine. For large databases, I will write another series where I will show you how to make a long download time appear small to the user.
We shall carry on in the next part of the series where we shall see how to maximize and restore the images.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |