Jump to content

Recommended Posts

Posted

I have designed two forms, first one is feedbackform.html and the second one is messagesent.php.

When someone fills in the feedbackform and clicks submit, it gives the message that Thank you for message. We will respond as soon as we can. My feedback form is suppose to send me the comments to my email address but unfortunately it doesn't do that. I have checked my code again and again but can't see what I have done wrong.

Following is the code for my feedbackform.html:

 

 




Untitled Document



Website comments/Suggestions
</pre><form id="frm_message" name="frm_message" method="post" action="messagesent.php">
 
   
     Website comments/Suggestions 
   
   
      
      
   
   
     Your email address 
     
   
   
     Subject
     
     
     
   
   
     Comments
     
   
   
      
     
   
   
      
      
   
   
      
      
   
 
</form><br><p>
 
 
 
 
</p><b

 

My code for the messagesent.php is as follows:

 




Untitled Document





mail($_POST['[email protected]'], $_POST['subject'],
$_POST ['textarea']);
?>


Thank you for message. We will respond as soon as we can.  

 

Would someone help me please. Check the above two and see where I am going wrong.

 

Thanks in advance.

 

Jay

Posted (edited)

No I used the school email address and it didn't work. This morning I put gmail address and it did work so I don't understand why it wouldn't work with the other addresses.

Sorry I noticed that you were just referring to the spelling mistake. With the correct gmail address it does work, but doesn't work with hotmail or the school email address. I am certain that I have not got a spelling mistake.

Edited by tannajay
Posted (edited)

Have you managed to get any other of your PHP scripts to send an email?

There is some settings in the php.ini file you need to set before you can send mail using a PHP script.

 

I set these in the PHP script where I need it to send an email:

 

ini_set('SMTP','email server address');

ini_set('smtp_port','25');

ini_set('sendmail_from','[email protected]');

Edited by cl0n3
Posted

Your call to the mail function appears to be wrong in messagesent.php, you are passing a variable to it that has not been declaired: $_POST['[email protected]']

 

It should read something like:

 

mail('[email protected]', $_POST['subject'], $_POST['textarea'], 'From: '.$_POST['emailaddress']."\r\n");

 

Take a look here for more info on the mail function.

 

Hope that is of some help,

 

Iain

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...