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>
hmm interesting Question - why do you have your index.cfm in the cfide folder? Don't do that, put it somewhere else. Index.cfm looks good Action.cfm needs some changes - consider this instead: <cfif IsDefined("Form.email")> <cfquery name = "InsertComments" datasource="comments"> INSERT INTO COMMENTS (name,email,comments) Values ('#Form.name#','#Form.email#','#Form.comments#') </cfquery> <CFMAIL TO= "email@andyjessop.co.uk" FROM= #Form.email# SUBJECT= "Comments about website"> Thank you for sending in your comments. </CFMAIL> <!--- I'm not sure why you are doing this but here is the query you had ---> <cfquery name = "Getcomments" datasource="comments"> SELECT NAME,EMAIL,COMMENTS FROM COMMENTS </cfquery> <cfdump var="#GetComments#"> </cfif> If per chance your comments table has a lot of records you can do with you dumping it. I only added the dump so that you can see that it was inserted into the DB. Also, you may need to check to see if you have a mail server defined in the ColdFusion Administrator. If not, you will need to explicitly state what the server is. PS: Look up the documentation on the cfmail tag. Hope I helped DaTropics!