logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 01-27-2015, 06:42 AM   #1
jamieee0810
 
Join Date: Jan 2015
Posts: 5
Default Problem with Contact Form - Won't link textfields

Hi All I'm hoping someone can help me out with this problem that I've been staring at for two days now and I can't seem to figure it out even with countless tutorials and forums! Basically I'm new to Dreamweaver but am having a go at building myself a website - rather than try doing it from scratch I figured I'd get a template from the web and edit it. Now there already existed in the template a contact form but no PHP file to get it to send and the button that was created had no actions on it. I got a tutorial on how to put together the PHP file and renamed the text fields to how they exist in the template and added the action to the button which only half works - the email sends but it doesn't link what's in the text boxes so I pretty much get a blank email (except for the small bits that are hard coded in. The html for the form is as follows:

HTML Code:
   <form action="RoyleData.php" method="post" name="Contact" id="Contact">
              <div class="form-group">
                <input name="fullname" type="text" class="form-control" id="fullname" placeholder="Your Name" maxlength="30">
              </div>
              <div class="form-group"></div>
              <div class="form-group">
                <p>
                  <input name="email" type="text" class="form-control" id="email" placeholder="Your Email" maxlength="30">
                </p>
              </div>
              <div><button type="button" class="btn btn-primary" onClick="MM_validateForm('fullname','','R','email','','RisEmail','message','','R');MM_goToURL('parent','RoyleData.php');return document.MM_returnValue">Send Message</button></div>
            
          
          <div class="col-md-9">
            <div class="txtarea">
              <textarea name="message" rows="10" class="form-control" id="message"></textarea>
           </form>
and the PHP file...

PHP Code:
<?php

/* Email Variables */
$emailSubject 'RoyleData'/*Make sure this matches the name of your file*/
$webMaster 'jamie@royledata.com';

/*design by Mark Leroy @ http://www.helpvid.net*/

/* Data Variables */
$email $_POST['email'];
$name $_POST['fullname'];
$comments $_POST['message'];



$body = <<<EOD
<br><hr><br>
Name: 
$name <br>
Email: 
$email <br>
Comments: 
$comments <br>
EOD;
$headers "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success mail($webMaster$emailSubject$body,
$headers);


/* Results rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content="3;URL=http://www.royledata.com">
<style type="text/css">
<!--
body {
background-color: #444; /* You can edit this CSS to match your website*/
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #fec001;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
}
-->
</style>
</head>
<div align="center">Thank-you for your enquiry, I will be in touch very soon.</div>
</div>
</body>
</html>
EOD;
echo 
"$theResults";
?>
I would appreciate any help with this - I'm sure the answer is simple but it is just escaping me!!
jamieee0810 is offline   Reply With Quote
Old 01-27-2015, 07:34 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

as you didnt show your validation i took it out changed the button and it sent all with data
Code:
<form action="RoyleData.php" method="post" name="Contact" id="Contact">
              <div class="form-group">
                <input name="fullname" type="text" id="fullname" placeholder="Your Name" maxlength="30">
              </div>
              <div class="form-group"></div>
              <div class="form-group">
                <p>
                  <input name="email" type="text" vid="email" placeholder="Your Email" maxlength="30">
                </p>
              </div>
              <div><input name="" type="submit" value="Submit"></div>
            
          
          <div class="col-md-9">
            <div class="txtarea">
  <textarea name="message" rows="10" id="message"></textarea>
</form>
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 01-27-2015, 07:38 AM   #3
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

a really easy form (javascript) validator is at http://formvalidator.net/
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 01-27-2015, 08:29 AM   #4
jamieee0810
 
Join Date: Jan 2015
Posts: 5
Default

Thank-you I really appreciate you taking the time to help me with this - I'll try it when I get home and let you know how I get on.
jamieee0810 is offline   Reply With Quote
Old 01-27-2015, 08:21 PM   #5
jamieee0810
 
Join Date: Jan 2015
Posts: 5
Default

That worked perfectly thank-you so much. With a bit of jiggery-pokery I was able to get it to look the same.
jamieee0810 is offline   Reply With Quote
Old 01-28-2015, 08:33 AM   #6
jamieee0810
 
Join Date: Jan 2015
Posts: 5
Default

Further to this upon testing it, it appears to work intermittently. I don't seem to get the emails whenever I put an actual email address in the email box. Presumably this issue is in the PHP script - is there anything you can see that might be causing this.

To explain a little more if I put "TEST" in the email field I get the complete email from TEST@hosts.co.uk, if I put XYZ@hotmail.com I don't get an email at all. I guess this could also be an issue with the host itself?
jamieee0810 is offline   Reply With Quote
Old 01-28-2015, 08:53 AM   #7
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

sounds like it could be a validation issue
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 01-28-2015, 05:53 PM   #8
jamieee0810
 
Join Date: Jan 2015
Posts: 5
Default

OK for anybody else that might come across this issue (the helpvid tutorial on contact forms and the php script provided seems pretty widely used) I managed to get past the issue by slightly amending the php script.

The issue was in this part:

PHP Code:
$body = <<<EOD 
<br><hr><br
Name$name <br
Email$email <br
Comments$comments <br
EOD
$headers "From: $email\r\n"
$headers .= "Content-type: text/html\r\n"
$success mail($webMaster$emailSubject$body
$headers); 
In particular the "From: $email\r\n", instead of calling the email textbox from the contact form as the sender I changed it to something generic i.e. swap '$email' with 'xyz'. I assume there is an issue with receiving an email from 'xyz@xzy.com@hosts.co.uk' however I would not like to speculate because I simply don't know.

Thanks again for your help edbr.
jamieee0810 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:26 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com