February 11, 201412 yr I've created a contact form using Adobe Dreamweaver, but I can't work out how to get it sent to my email address when someone fills it in. While creating the form using Dreamweaver I've used some Spry Validation Text Fields to create the required fields in my form. Although I'm not sure if that could interfere with the PHP code. I've put the code for my form below: <form id="form1" name="form1" method="post" action="contact-us-submit.html"> <span id="sprytextfield1"> <label for="text1">Name <span class="required">*</span></label> <input name="text1" type="text" class="c-name" id="text1" size="35" autofocus="autofocus" /> <span class="textfieldRequiredMsg">Please enter your name</span></span> <p><span id="sprytextfield2"> <label for="text2">Email address <span class="required">*</span></label> <input name="text2" type="text" class="c-emailaddress" id="text2" size="35" /> <span class="textfieldRequiredMsg">Please enter your email address</span><span class="textfieldInvalidFormatMsg">Please enter a valid email address, e.g. name@example.com</span></span></p> <p><span id="spryconfirm1"> <label for="text3">Re-enter email address <span class="required">*</span></label> <input name="text3" type="text" class="c-confirmemailaddress" id="text3" size="35" /> <span class="confirmRequiredMsg">Please re-enter your email address</span><span class="confirmInvalidMsg">The two email addresses don't match</span></span></p> <p><span id="sprytextarea1"> <label for="textarea1">Message <span class="required">*</span></label> <textarea name="textarea1" cols="28" rows="5" class="message" id="textarea1"></textarea> <span class="textareaRequiredMsg">Please enter your message</span></span></p> <p> <input name="Reset" type="reset" class="resetbutton" id="button" value="Reset" /> <input name="button2" type="submit" class="submitbutton" id="button2" value="Submit" /> </p> </form> As well as the code that Dreamweaver has inserted to control the Spry form fields (looking at the code, it looks like the extra code is mainly to display the error messages when incorrect information is entered), there's some CSS classes that I've put in to control the style/layout of the form (which I think has probably confused things even more). Could someone tell me what PHP code I need to write to get this form sent to my email address please (if it can be done when using the Spry form fields)? Thank you for any help. P.S. I haven't put my email address on here because I'm always a bit concerned about putting my email address on public forums, so I just wanted to let you know that it's not because I don't trust anyone, it's just that I'm a bit overcautious. Thank you again. Edited February 11, 201412 yr by dandydan1152
February 11, 201412 yr Author Sorry that there's a lot of code, I didn't do any of the code myself, so it's just how Dreamweaver has done it. I don't have much experience with HTML code (especially forms), so I can't tell whether there's any code that I could delete.
February 11, 201412 yr Hello. You have only created the actual form you will also need some php to process the data. Your action attribute of the form tag is set to an html file, it will need to be a php file. webdesigner93 from this forum has made this email class you can use. http://www.webdesignerforum.co.uk/topic/67494-simple-php-mail-class-tutorial/ Edit: Your asking if you can remove some html code: You migt not need a class attribute for every input unless you want a unique style for each of them Edited February 11, 201412 yr by Nillervision
February 11, 201412 yr Author Thank you for your help Nillervision, I'm going to leave the class attributes in because I have a different positioning for each of the fields on the page. I'll change the submit page to a PHP file. Thank you again.
Create an account or sign in to comment