PDA

View Full Version : Contact form problems


BullDog
08-15-2015, 07:24 PM
I'm not sure if this is too much to ask, but would appreciate any input you can provide.

I am using "contact form generator" from top studio (https://www.contactformgenerator.net/) I have used this from time to time for a couple years. It displays fine and submissions work fine from others, but when I submit the form it worked once... and then it appears to submit but its never received.

I understand this sounds like a local issue, but I cant determine why.

http://flat4design.com/softpawz/contact.php

Thank you

BullDog
08-15-2015, 07:52 PM
Appears to have been a local issue, maybe a browser issue. Still stumped as I've been playing with it for days. same issue with multiple browsers, not a cookie issue... unsure what could cause it to work once and never again... but works fine for others.

BullDog
08-15-2015, 07:58 PM
I spoke too soon. tried for a third time and nothing has been received.

edbr
08-16-2015, 12:30 AM
Need to see the code for the mail sending page

edbr
08-16-2015, 02:14 AM
Or try this http://dreamweaverclub.com/forum/showthread.php?t=47752

BullDog
09-04-2015, 01:53 AM
I found the problem but I'm tearing my hair out with what should be a simple fix. I have floated the form elements left and the image right. but cant get them side by side. A second set of eyes would be greatly appreciated.

Thanx

http://flat4design.com/aspire/contact.php

edbr
09-04-2015, 02:22 AM
the problem comes when you add the css for the form, so check through the widths etc.
its simple a form so why not make it simpler and then apply media queries to the design layout css.
you only need to style inputs and labels

BullDog
09-04-2015, 02:29 AM
the form validation etc, is beyond me... I am using a form generator, then trying to simply style a bit. that top image is the only thing I cant figure out thus far

BullDog
09-04-2015, 02:31 AM
If I need to I can revert back to no validation and keep it simple. Just trying to help a friend with this form change

edbr
09-04-2015, 02:33 AM
ok try this then remove the link to the form css first

BullDog
09-04-2015, 02:35 AM
ok the problem is definitely in the form.css

edbr
09-04-2015, 02:39 AM
check the widths ( especially the container) floats etc\

BullDog
09-04-2015, 02:40 AM
they all seem to fit within parameters

BullDog
09-04-2015, 02:43 AM
container is 100% width, form elements are floated left and image is floated right

BullDog
09-04-2015, 02:46 AM
even if I shrink the form elements down to 100px, the image is not falling into place

BullDog
09-04-2015, 03:09 AM
Thank you. I'm obviously over my head here. now I've screwed up the form somewhere. it appears to send but I receive nothing. I will have to look for something I can put together simply, and then try to style it without validation.

edbr
09-04-2015, 04:24 AM
try this i posted, tested and works http://dreamweaverclub.com/forum/showthread.php?t=47752

BullDog
09-04-2015, 12:53 PM
ok I simplified the form, without validation for now. But I am back to the old problem where it doesnt send the email consistently.

It worked for a few tests, then nothing.

http://flat4design.com/aspire/contact.php

BullDog
09-04-2015, 01:41 PM
The only issue I can find is the way "for" is in green in the code. using dreamweaver cc.

Am I missing an error somewhere or could this be a glitch in dreamweaver?

edbr
09-05-2015, 02:12 AM
no i dont see that being an issue. also if it works sometimes and not otherws i dont get it either, its not a choice either the code is good or it isnt.
i just tested your page and it gave a thank you message so i assume it was sent.

BullDog
09-05-2015, 03:31 AM
it sends but never recieved

edbr
09-05-2015, 04:03 AM
ah, never? post your mail sending code

BullDog
09-05-2015, 04:07 AM
It did work initially, so I must have a typo in there from when I added some styling.


<?php

/* Subject and email variables */

$emailSubject = 'From Contact Form';
$owner = 'mattsilva@comcast.net';

/* Data Variables */

$firstName = $_POST['firstname'];
$lastName = $_POST['lastname'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$message = $_POST['Message'];

$body = <<<EOD
<br><hr><br>
First Name: $firstName <br>
Last Name: $lastName <br>
Email: $email <br>
Phone: $telephone <br>
Message: $message <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail ($owner, $emailSubject, $body, $headers);

/* Results Rendered as HTML */

$theResults = <<<EOD
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<link href="css/default.css" rel="stylesheet" type="text/css" />

<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

<META NAME="Description" CONTENT="Promotional Advertising, Promo, logo, business, creative writing, web content, marketing tools, graphic design services, brochures, postcards, flyers, notary, Alameda, small business, visual communication, apparel, products include; auto, tools, flashlights, awards, calendars, drinkware, sports, health and wellness, office accessories, writing instruments, coolers, backpacks, desktop, business cases and more! Supplier of sanmar, broder bros, Bic, Norwood, Bagmakers, expressline, Hit Promotional Products, LogoMark, Port Authority, Gilden, American Apparel, Adidas, Anvil, Bella, Champion, Badger Sport, Bayside, Ultraclub, Alo, Anvilorganic, Fruit of the Loom, Gildan, Hanes, Izod, Jerzees, Outerbanks, Rabbitskinss, Taylor Made, Timberland, VanHeusen, Bodek and Rhodes, Broder, Iclick, Showdown Displays, Nes Clothing, Imprints Wholesale, Otto Cap, Otto International, Aspire Business Consulting, Embroidery, Screen printing, Awards, branding websites, online stores, Nike Golf, OGIO, New Era, Columbia, Red House, bags, flashdrives, caps, t-shirts, custom tee-shirt design" />

<META NAME="keywords" CONTENT="Promotional Advertising, Promo, logo, business, creative writing, web content, marketing tools, graphic design services, brochures, postcards, flyers, notary, Alameda, small business, visual communication, apparel, products include; auto, tools, flashlights, awards, calendars, drinkware, sports, health and wellness, office accessories, writing instruments, coolers, backpacks, desktop, business cases and more! Supplier of sanmar, broder bros, Bic, Norwood, Bagmakers, expressline, Hit Promotional Products, LogoMark, Port Authority, Gilden, American Apparel, Adidas, Anvil, Bella, Champion, Badger Sport, Bayside, Ultraclub, Alo, Anvilorganic, Fruit of the Loom, Gildan, Hanes, Izod, Jerzees, Outerbanks, Rabbitskinss, Taylor Made, Timberland, VanHeusen, Bodek and Rhodes, Broder, Iclick, Showdown Displays, Nes Clothing, Imprints Wholesale, Otto Cap, Otto International, Aspire Business Consulting, Embroidery, Screen printing, Awards, branding websites, online stores, Nike Golf, OGIO, New Era, Columbia, Red House, bags, flashdrives, caps, t-shirts, custom tee-shirt design" />

<title>Aspire - Thank You</title>

</head>

<body>

<div class="wrapper">

<div>
<div align="center"><a href="./"><img src="graphics/aspire5.png" border="0" alt="logo" /></a></div>
</div> /* close header */
<br />

<div class="navNew">
<div class="button"><a href="./">home</a></div>
<div class="button"><a href="services.php">services</a></div>
<div class="button"><a href="http://promoplace.com/aspire" target="_blank">promo gear</a></div>
<div class="button"><a href="about.php">about</a></div>
<div class="button"><a href="contact.php">contact</a></div>
</div>

<div class="clearboth"></div>

<div class="quote">
<img src="graphics/quote.png" alt="quote" vspace="10" />
</div> /* close quote */

<hr width="800">

<div class="thankyou">

<h3>Thank you for your interest. Your email will be answered very soon!</h3>

</div> /* close thankyou */

<hr width="500">

<div align="center"><font color="#5C5C5C">Copyright &copy; 2007-2015 - AspireBizConsult.com - All rights reserved.</font></div>
<p>
<div class="designby">
Website by <a class="designedBy" href="mailto:mattsilva@comcast.net?Subject=From Softpawz Website">Flat4Design<br />
<img src="graphics/small_f4d.png" alt="Flat4Design Logo"></a>
</div>
</p>
&nbsp;

</div> /* close wrapper */

</body>
</html>
EOD;

echo "$theResults";

?>

edbr
09-05-2015, 04:30 AM
ok ill try to look at it over the weekend but it might be monday as im a bit busy this weekend

edbr
09-05-2015, 04:33 AM
ah hold the phone. you sjhould close the php block before the html starts, that may be your error

<?php

/* Subject and email variables */

$emailSubject = 'From Contact Form';
$owner = 'mattsilva@comcast.net';

/* Data Variables */

$firstName = $_POST['firstname'];
$lastName = $_POST['lastname'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$message = $_POST['Message'];

$body = <<<EOD
<br><hr><br>
First Name: $firstName <br>
Last Name: $lastName <br>
Email: $email <br>
Phone: $telephone <br>
Message: $message <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail ($owner, $emailSubject, $body, $headers);

/* Results Rendered as HTML */

$theResults = <<<EOD

?>


then at the end

</html>

<?php
EOD;

echo "$theResults";

?>

BullDog
09-05-2015, 06:26 AM
Thank you. I have never really played with php other than to use includes.

Well it didnt work the first time, then worked the second, and again didnt work on the third attempt.

BullDog
09-05-2015, 06:27 AM
The way I understood it is there couldnt be anything other than what you want displayed after the EOD and before the ending EOD. is that not correct?

BullDog
09-05-2015, 06:31 AM
you can see here in the upper left corner:

BullDog
09-05-2015, 06:33 AM
seems to be random... test 4 worked and test 5 didnt

edbr
09-05-2015, 06:44 AM
Actually the last php block should big in the page body not after the closing html

BullDog
09-05-2015, 06:51 AM
not sure I follow you as the page displayed is between the EOD's

cant find the page I read it on but the video I followed was specific about not having and extra spaces, returns, etc. after the EOD.

Old video but this is what I followed:

https://www.youtube.com/watch?v=rdsz9Ie6h7I

mentioned at about 19:45

edbr
09-07-2015, 02:18 AM
right not into youtube gurus. so
i never use ,,,EOD but code the variables myself
does it mention security? i see no sanitation of the $_POST variables.
no honey trap or captcha.

BullDog
09-07-2015, 02:29 AM
better to find a way to forward to another page and bypass the EOD maybe? This is a low traffic site. just looking for function and dressed it up a bit over what she had before

BullDog
09-07-2015, 02:31 AM
maybe over used but I prefer to use my includes. more files but much cleaner for me and future edits

edbr
09-07-2015, 03:00 AM
yes but spam bots dont care if a vunerability is detected it can be used to send many mail.

BullDog
09-07-2015, 03:02 AM
ok happy to take your suggestions. I would like to learn this and setup a standard I can use in the future.

So should I try to adapt the code you posted earlier in this thread? Then skip the EOD and simply figure out how to forward to another "thank you" page?

Then maybe do a 3-5 second redirect back to the home page?

edbr
09-07-2015, 03:12 AM
take a look at the link i sent , it has a haonetrap , more headers and is sanitised. i dont guarantee but try it
http://dreamweaverclub.com/forum/showthread.php?t=47752