官术网_书友最值得收藏!

Adding a new record

We have seen the update function work. But, we have not seen the working of our insert function yet. We will modify the code so that we can add a new record. We will have to modify the content section of the product_list.cfm page to complete this function. The previous page is already set up to run:

<!--- Content --->
<cfif url.message NEQ "">
<div>
<cfoutput>#url.message#</cfoutput>
<hr />
</div>
</cfif>
<h3>Select a product to edit.</h3>
<ul>
<li>
<a href="product_edit.cfm">+ New Product
</li>
<cfoutput query="rsProducts">
<li>
<a href="product_edit.cfm?id=#rsProducts.id#">#rsProducts.name#
</li>
</cfoutput>
</ul>

Now, let us observe the page again. Once the page is loaded, and we click on refresh, we will see the following page:

Let us click the + New Product link, and observe what we get. We receive a new form to fill in the details. Let us enter some information and see how a new record is being added:

The following screenshot shows the new record:

In the previous screenshot, we can see that the record has been stored. Now, we are able to fully manage our database table by using the editing functions that we have built into our pages.

主站蜘蛛池模板: 孝昌县| 林口县| 册亨县| 万全县| 邮箱| 曲阳县| 商都县| 磐石市| 台南县| 德昌县| 读书| 马山县| 德州市| 临漳县| 望江县| 达日县| 柘城县| 通州区| 黄山市| 来宾市| 云林县| 兴城市| 大足县| 肃北| 湘潭县| 涿州市| 莲花县| 北碚区| 广西| 基隆市| 四子王旗| 五河县| 抚松县| 呼和浩特市| 鄱阳县| 通许县| 湖南省| 宁陵县| 江阴市| 巢湖市| 原阳县|