Skip to main content
Participant
May 21, 2012
Question

Form not returning variable - getting Variable is Undefined

  • May 21, 2012
  • 2 replies
  • 774 views

I have a simple form with a simple insert statement. I keep getting this error:

Variable 'firstname' is UNDEFINED

This is just part of my form. I only am using this part because if I can't get firstname to insert then the rest doesn't matter.

<form action="submitform.cfm" method="post">

<input type ="text" name="firstname" value="" size="25" >

</form >

That goes to this query:

<cfquery name="qinsert" datasource="name" >

INSERT INTO tablename (firstname)

VALUES ('#firstname#')

</cfquery>

I have done <cfdump> and it returned 'empty'.  I can't figure out why the variables aren't passing through.

Thank you!!!

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
May 23, 2012

I will assume that the query is in the form's action page, submitform.cfm. What is then lacking is an event to submit the form. Add, for example, a submit button to the form.

Inspiring
May 21, 2012

Are these two bits of code on the same page?