Skip to main content
Dez Dalton
Participating Frequently
April 11, 2019
Question

How do I get my forms to work and receive replies

  • April 11, 2019
  • 1 reply
  • 4091 views

Hi,

I am having a major problem getting my email forms to work via my server my website Registration and Contact pages are both constructed in Dreamweaver CC using the FormMail Post method code. The server I'm using is Crazy Domains to host my site. They do have php available. I have a php file in their cgi-bin folder to work the backend but this file may not be configured correctly as I keep receiving the 500 error codes when I test sending the form from my website via internet. I was hoping someone will be able to help me get my forms working properly to receive the enquiries to my emails inbox. I'm using a MacBook pro mid 2012 which handles the Dreamweaver program nicely. Website pages: www.reikiempowermentseminars.com.au/assets/contact.html  www.reikiempowermentseminars.com.au/assets/registration.html

Here is the code I'm using for the post form method.

<form  action=https://www.reikiempowermentseminars.com.au/cgi-bin/testemail-1.php

method="post" onsubmit="processForm(this);return false" name="enroll" id="enroll"><div id="treatmentcontact" class="fluid">

           

<div><input name="recipient" type="hidden" id="recipient" value="dezdalton@reikiempowermentseminars.com.au" />

<input type="hidden" name="subject"  id="subject" value="REIKI TREATMENT ENQUIRY" />

<input name="redirect" type="hidden" id="redirect" value="https://www.reikiempowermentseminars.com.au/assets/thankyoupage.html" /></div>

The php file in the cig-bin/testemail-1.php is on the cpanel remote server.

Here's the php code

<?php

// THE BELOW LINE STATES THAT IF THE SUBMIT BUTTON

// WAS PUSHED, EXECUTE THE PHP CODE BELOW TO SEND THE

// MAIL. IF THE BUTTON WAS NOT PRESSED, SKIP TO THE CODE

// BELOW THE "else" STATEMENT (WHICH SHOWS THE FORM INSTEAD).

if ( isset ( $_POST [ 'buttonPressed' ] )){

// REPLACE THE LINE BELOW WITH YOUR E-MAIL ADDRESS.

$to = 'dezdalton@reikiempowermentseminars.com.au' ;

$subject = 'From PHP contact page' ;

// NOT SUGGESTED TO CHANGE THESE VALUES

$message = $_POST [ "message" ] ;

$headers = 'From: ' . $_POST[ "from" ] . PHP_EOL ;

mail ( $to, $subject, $message, $headers ) ;

// THE TEXT IN QUOTES BELOW IS WHAT WILL BE

// DISPLAYED TO USERS AFTER SUBMITTING THE FORM.

echo "Your e-mail has been sent! You should receive a reply within 24 hours!" ;}

else{

?>

<form method= "post" action= "<?php echo $_SERVER [ 'PHP_SELF' ] ;?>" />

  <table>

    <tr>

      <td>Your e-mail address: </td>

      <td><input name= "from" type= "text"/></td>

    </tr>

    <tr>

      <td>Your message: </td>

      <td><textarea name= "message" cols= "20" rows= "6"></textarea></td>

    </tr>

    <tr>

      <td></td>

      <td><input name= "buttonPressed" type= "submit" value= "Send E-mail!" /></td>

    </tr>

</table>

</form>

<?php } ?>

Please advise if there is something missing or not configured correctly here.

Thanks for your kind help and assistance. Dez

This topic has been closed for replies.

1 reply

Nancy OShea
Community Expert
Community Expert
April 11, 2019

Which form processing script does your host recommend you use?   Also find out if your hosting plan supports the PHP mail () function to send mail.  If ti doesn't, you'll need to find a script that uses SMTP instead.

Nancy O'Shea— Product User & Community Expert
Dez Dalton
Participating Frequently
April 12, 2019

Hi Nancy,

Many thanks for your great advice!

I feel that I'm getting closer to having my forms functioning properly.

My hosting plan supports PHP mail functionality in sending mail. They said I'll need to use an SMTP for it to work. Refer this link below on how to use PHP mailer for their hosting.

https://www.crazydomains.com.au/help/how-to-add-phpmailer-for-linux-and-windows-hosting/

Is this difficult process to configure and set up?

Thx, Dez

BenPleysier
Community Expert
Community Expert
April 12, 2019

The file that you are using as the action file, testemail-1.php contains the code that should be used in your main document.

In other words, scrap

<form  action=https://www.reikiempowermentseminars.com.au/cgi-bin/testemail-1.php

method="post" onsubmit="processForm(this);return false" name="enroll" id="enroll"><div id="treatmentcontact" class="fluid">

          

<div><input name="recipient" type="hidden" id="recipient" value="dezdalton@reikiempowermentseminars.com.au" />

<input type="hidden" name="subject"  id="subject" value="REIKI TREATMENT ENQUIRY" />

<input name="redirect" type="hidden" id="redirect" value="https://www.reikiempowermentseminars.com.au/assets/thankyoupage.html" /></div>

and replace with

<?php

// THE BELOW LINE STATES THAT IF THE SUBMIT BUTTON

// WAS PUSHED, EXECUTE THE PHP CODE BELOW TO SEND THE

// MAIL. IF THE BUTTON WAS NOT PRESSED, SKIP TO THE CODE

// BELOW THE "else" STATEMENT (WHICH SHOWS THE FORM INSTEAD).

if ( isset ( $_POST [ 'buttonPressed' ] )){

// REPLACE THE LINE BELOW WITH YOUR E-MAIL ADDRESS.

$to = 'dezdalton@reikiempowermentseminars.com.au' ;

$subject = 'From PHP contact page' ;

// NOT SUGGESTED TO CHANGE THESE VALUES

$message = $_POST [ "message" ] ;

$headers = 'From: ' . $_POST[ "from" ] . PHP_EOL ;

mail ( $to, $subject, $message, $headers ) ;

// THE TEXT IN QUOTES BELOW IS WHAT WILL BE

// DISPLAYED TO USERS AFTER SUBMITTING THE FORM.

echo "Your e-mail has been sent! You should receive a reply within 24 hours!" ;}

else{

?>

<form method= "post" action= "<?php echo $_SERVER [ 'PHP_SELF' ] ;?>" />

  <table>

    <tr>

      <td>Your e-mail address: </td>

      <td><input name= "from" type= "text"/></td>

    </tr>

    <tr>

      <td>Your message: </td>

      <td><textarea name= "message" cols= "20" rows= "6"></textarea></td>

    </tr>

    <tr>

      <td></td>

      <td><input name= "buttonPressed" type= "submit" value= "Send E-mail!" /></td>

    </tr>

</table>

</form>

<?php } ?>

Edit: You are using HTTPS to serve the website, therefore you should also use HTTPS links to the web site. See your code for http://www.modernizr.com/

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!