Jump to content

Contact form


chiarar

Recommended Posts

If try sending anything through contact form (www.creativecollective.biz/contact.php) I don't receive email in my inbox. I also wanted message - Thank you for contacting us. We will be in touch with you very soon to appear once sent. 

 

Form doesn't seem to send when I press send and then form becomes blank.

 

Thank you for your help

Link to comment
https://forums.phpfreaks.com/topic/277010-contact-form/#findComment-1425086
Share on other sites

Ok great, now if I change then the page loads to this url - it doesn't email or return to contact form with message saying sent.

http://www.creativecollective.biz/contact-action.php?name=chiara&email=chiararestucci%40googlemail.com&subject=tester&message=tester&submit=Send+Message

 

I really have no idea what this means.

Further help much appreciated.

Thanks

Link to comment
https://forums.phpfreaks.com/topic/277010-contact-form/#findComment-1425126
Share on other sites

I guess your contact-action.php file is expecting a post action. So, you also need to add that:

<form action="contact-action.php" method="post" id="contactForm">

The output on that file will either be "OK" or a validation error message. You can modify those text strings in that file if you want them to be different.

Link to comment
https://forums.phpfreaks.com/topic/277010-contact-form/#findComment-1425137
Share on other sites

Hi,

Thank you that it is great, this now send email and does work as you have outlined above.

I was hoping that after the message is sent it would show the 'Thank You' message and hide the form - with script below.

 

I wondered if you might no how I adopt the above to do this.

 

Thanks again for your help.

 

 

 

 

 

 

<script type="text/javascript">
//<![CDATA[
var $j = jQuery.noConflict();
$j(document).ready(function(){
$j("#contactForm").submit(function(){
 
var str = $j(this).serialize();
 
   $j.ajax({
   type: "POST",
   url: "contact.php",
   data: str,
   success: function(msg){
    
$j("#note").ajaxComplete(function(event, request, settings){
 
if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
{
result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
$j("#fields").hide();
}
else { result = msg; }
$j(this).html(result);
}); } });
return false;
});});
//]]>
</script>  

 

Link to comment
https://forums.phpfreaks.com/topic/277010-contact-form/#findComment-1425160
Share on other sites

Oh, I didn't even notice the Javascript at the bottom. If you are using AJAX, you can actually put your form HTML back to the way it was:

<form action="#" id="contactForm">

You will need to change the Javascript on line 154 to:

   url: "contact-action.php",

That will send the request to the correct file. And everything else looks ok.

 

I don't see you loading the jQuery library, though. You might also need to add this line in contact.php:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
Link to comment
https://forums.phpfreaks.com/topic/277010-contact-form/#findComment-1425174
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.