ColdFusion Programming/Help with a Form

Advertisement


Question
"This is my coding:

<cfquery name="Add" datasource="library"> INSERT INTO Authors (AuthLast, AuthFirst, PublishedWorks, Publisher, PubDate, Price, ISBN) VALUES ('#Form.AuthLast#',
  '#Form.AuthFirst#',
  '#Form.PublishedWorks#',
  '#Form.Publisher#',
   #Form.PubDate#,
   #Form.Price#,
   #Form.ISBN#)
</cfquery>

The problem that I'm having is that I get the following error:

Element PUBLISHER is undefined in FORM."

Can you help?

Answer
Aloha,
You didn't show the form so that is what I recommend. Check the form to make sure Publisher is a field in the form and is spelled the same way.

Also you need to verify that all fields have an entry before attempting to put them in the database. So doing a <cfparam name="form.publisher" default=""> will at least give a blank entry.

If all else fails, put this before the query to see what the form is sending over.
<cfoutput><cfdump var="#form#"></cfoutput>

That will show you everything that is being sent by the form

ColdFusion Programming

All Answers


Answers by Expert:


Ask Experts

Volunteer


Donald Hammond

Expertise

Expert in ColdFusion, Flash ActionScript, XML, and SQL.

Experience

Cold Fusion, Flash Action Script

©2012 About.com, a part of The New York Times Company. All rights reserved.