Jump to content

Trying to add mail function in CmsController.php for form


romy1103

Recommended Posts

Hello There,

 

 

 I am trying to add custom form in one of my cams page after adding the below form code in cms page and the mail script below in cmscontroller.php but getting error continuously.

 

form code in cms page:

 

<form action="" method="post">

<div><label>NAME</label>
<div><input id="name" style="width: 220px; height: 28px;" name="name" type="text" /></div>
</div>
<br />
<div><label>Email</label>
<div><input id="email" style="width: 220px; height: 28px;" name="email" type="text" /></div>
</div>
<br />
<div><label>Phone No (Optional)</label>
<div><input id="phone_number" style="width: 220px; height: 28px;" name="subject" type="text" /></div>
</div>
<br />
<div><label>Message</label>
<div><textarea id="message" style="width: 340px; height: 100px;" cols="25" name="message" rows="6"></textarea></div>
</div>
<br />
<div><input class="button" name="customcontact" type="submit" value="Submit" /></div>
</form>
 
 
Mail Script in  cmscontroller.php
 
if (isset($_POST[‘customcontact']))
{
            
        $name = $_POST['name'];
        $email = $_POST['email'];
$phonenumber = $_POST[‘phone_number’];
        $message = $_POST['message'];
        $formcontent="From: $name \n Email: $email \n Message: $message";
        $recipient = “[email protected]”;
        $subject = "Quick Contact Form";
         $mailheader = "From: $email \r\n";
        mail($recipient, $subject, $formcontent, $mailheader) or die("Error");
        header(“Location: http://ccintserver.com  / prestashop”) ;
            
}
 
I cannot figure out where the problem is.

Any help will be highly appreciated
 
Thanks!
Link to comment
Share on other sites

  • 2 months later...

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...