angrypenguin
Nov 6th 2006, 11:58 am
Hi all, I'm trying to create a really simple form that will accept name, email, and comments from a form and email the results to me. I can't see why the following code won't work. Can anyone help me?
Index.cfm
<table width="100%" border="0" cellpadding="8" cellspacing="0" class="comments_background">
<tr>
<td><cfform action="http://localhost:8500/cfide/commentssite/action.cfm" method="post" name="comments_form" class="blog_main_body" id="comments_form">
<p>Name:<br />
<cfinput name="name" type="text" id="name" size="50" maxlength="100" required="yes"/>
</p>
<p>Email address (Optional):<br />
<label>
<cfinput name="email" type="text" id="email" size="50" maxlength="100" />
</label>
</p>
<label></label>
<p>Comments:
<label>
<br />
<cftextarea name="comments" cols="50" rows="5" id="comments" required="yes"></cftextarea>
</label>
</p>
<p>
<label>
<input name="submit" type="submit" id="submit" value="Submit" />
</label>
<label>
<input name="reset" type="reset" id="reset" value="Reset" />
</label>
</p>
</cfform> </td>
</tr>
</table>
action.cfm
<cfquery name = "comments" datasource="comments">
SELECT NAME,EMAIL,COMMENTS
FROM COMMENTS
INSERT INTO COMMENTS (name,email,comments)
Values ('#comments.name#','#comments.email#','#comments.comments#')
</cfquery>
<CFMAIL TO= "email@andyjessop.co.uk"
FROM= #comments.email#
SUBJECT= "Comments about website">
Thank you for sending in your comments.
</CFMAIL>
Index.cfm
<table width="100%" border="0" cellpadding="8" cellspacing="0" class="comments_background">
<tr>
<td><cfform action="http://localhost:8500/cfide/commentssite/action.cfm" method="post" name="comments_form" class="blog_main_body" id="comments_form">
<p>Name:<br />
<cfinput name="name" type="text" id="name" size="50" maxlength="100" required="yes"/>
</p>
<p>Email address (Optional):<br />
<label>
<cfinput name="email" type="text" id="email" size="50" maxlength="100" />
</label>
</p>
<label></label>
<p>Comments:
<label>
<br />
<cftextarea name="comments" cols="50" rows="5" id="comments" required="yes"></cftextarea>
</label>
</p>
<p>
<label>
<input name="submit" type="submit" id="submit" value="Submit" />
</label>
<label>
<input name="reset" type="reset" id="reset" value="Reset" />
</label>
</p>
</cfform> </td>
</tr>
</table>
action.cfm
<cfquery name = "comments" datasource="comments">
SELECT NAME,EMAIL,COMMENTS
FROM COMMENTS
INSERT INTO COMMENTS (name,email,comments)
Values ('#comments.name#','#comments.email#','#comments.comments#')
</cfquery>
<CFMAIL TO= "email@andyjessop.co.uk"
FROM= #comments.email#
SUBJECT= "Comments about website">
Thank you for sending in your comments.
</CFMAIL>