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

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.

主站蜘蛛池模板: 息烽县| 禄丰县| 涿鹿县| 大宁县| 康马县| 武城县| 安宁市| 营山县| 东阿县| 定西市| 许昌县| 高雄市| 泰兴市| 青神县| 临洮县| 静乐县| 邹城市| 长武县| 盐城市| 贡觉县| 延边| 海兴县| 武汉市| 江城| 丰县| 巴东县| 黑水县| 东光县| 平山县| 沅江市| 勐海县| 云林县| 石景山区| 同江市| 肃宁县| 和硕县| 阿鲁科尔沁旗| 彭山县| 宁武县| 渝中区| 宣恩县|