Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Emerson Contact Form Stuck On Refresh When Submit Is Clicked

I have completed Mr. Paulk's course in Building Websites With PHP and am having difficulty with the form sending to a real website. I am hosting the page and have my email as the email for the data to be sent.

Is anyone else experiencing this problem? I thought it was my personal code that I wrote while following Mr. Paulk, so I grabbed his code from a fork and the same problem is occurring.

Any insight will be greatly appreciated.

On two servers I tried this project I got following error after sending contact form:

Slim Application Error
The application could not run because of the following error:

Details

Type: ErrorException
Code: 2
Message: proc_open() has been disabled for security reasons

Looks like this function is blocked on cheaper hosting. Maybe try running script from http://php.net/manual/en/function.proc-open.php to check if this function works ok on your server?

2 Answers

After reviewing some things on SwiftMailer I changed

$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');

to

$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -t');

Here is a note about using -t: If you run sendmail in "-t" mode you will get no feedback as to whether or not sending has succeeded. Use "-bs" unless you have a reason not to.

http://swiftmailer.org/docs/sending.html

I doubt this is the best way... but it does work!

Will look into and check back. I have an account with WebhostingForStudents... the one Treehouse suggests.

Seems to be working. With the example code from the website you provided.