Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9224143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:14:38+00:00 2026-06-18T04:14:38+00:00

Working on a project.. Ac-photography.net Need help with contact form. It doesnt seem to

  • 0

Working on a project.. Ac-photography.net

Need help with contact form. It doesnt seem to send and i keep getting “unexpected error message”

<div class="contact_form">
            <div class="done">
                    <b>Thank you!</b> I have received your message. 
                </div>

                <form method="post" action="process.php">
                    <p>name</p>
                    <input type="text" name="name" class="text" />

                    <p>email</p>
                    <input type="text" name="email" class="text" id="email" />

                    <p>message</p>
                    <textarea name="comment" class="text textarea"></textarea>

                    <input type="submit" id="submit" value="send" class="submit-button" />
                </form>

Not sure how to put up the PHP on here.

Any help is appreciated. Thank you.

    <?php

    //Retrieve form data. 
    //GET - user submitted data using AJAX
    //POST - in case user does not support javascript, we'll use POST instead
    $name = ($_GET['name']) ? $_GET['name'] : $_POST['name'];
    $email = ($_GET['email']) ?$_GET['email'] : $_POST['email'];
    $comment = ($_GET['comment']) ?$_GET['comment'] : $_POST['comment'];

    //flag to indicate which method it uses. If POST set it to 1
    if ($_POST) $post=1;

    //Simple server side validation for POST data, of course, you should validate the email
    if (!$name) $errors[count($errors)] = 'Please enter your name.';
    if (!$email) $errors[count($errors)] = 'Please enter your email.'; 
    if (!$comment) $errors[count($errors)] = 'Please enter your comment.'; 

    //if the errors array is empty, send the mail
    if (!$errors) {

//recipient
$to = 'Your Name <alex.cherkasov@gmail.com>';    // <--------- change your email here
//sender
$from = $name . ' <' . $email . '>';

//subject and the html message
$subject = 'Message from ' . $name; 
$message = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<table>
    <tr><td>Name</td><td>' . $name . '</td></tr>
    <tr><td>Email</td><td>' . $email . '</td></tr>
    <tr><td>Message</td><td>' . nl2br($comment) . '</td></tr>
</table>
</body>
</html>';

//send the mail
$result = sendmail($to, $subject, $message, $from);

//if POST was used, display the message straight away
if ($_POST) {
    if ($result) echo 'Thank you! We have received your message.';
    else echo 'Sorry, unexpected error. Please try again later';

//else if GET was used, return the boolean value so that 
//ajax script can react accordingly
//1 means success, 0 means failed
} else {
    echo $result;   
}

    //if the errors array has values
    } else {
//display the errors message
for ($i=0; $i<count($errors); $i++) echo $errors[$i] . '<br/>';
echo '<a href="form.php">Back</a>';
exit;
    }


    //Simple mail function with HTML header
    function sendmail($to, $subject, $message, $from) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";

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

if ($result) return 1;
else return 0;
    }

    ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:14:40+00:00Added an answer on June 18, 2026 at 4:14 am

    JavaScript part

    The form is not processed correctly because it doesn’t get any value. Take a look at contact-form.js.

    You’re building the data variable:

    var data = 'name=' + name.val() + '&email=' + email.val() + '&website=' + website.val() + '&comment='  + encodeURIComponent(comment.val());
    

    But than in the AJAX call you pass a string with the value data:

    //pass the data
    data: "data",
    

    Try this instead:

    //pass the data
    data: data,
    

    PHP part (process.php)

    When I simply call the script like this:

    http://ac-photography.net/process.php?email=test@test.com&name=name&comment=comment

    I’ll get a warning:

    Warning: mail() [function.mail]: SMTP server response: 550 > invalid address in D:\Hosting\6405740\html\process.php on line 72

    Fix this and check whether the mail was send correctly. It will than return 1 as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my working project is on visual fox-pro 9.0 , so i need design form
I have a question about a project i'm working on. The website is www.AC-photography.net
Im working on project where i need to test if domains has IPv6 addresses
I had a working project in VS2008 / .Net 3.5 using controls from the
I have a working project in SharePoint 2007 , I need to take this
I have a working project that Im amending, it crashes after trying to use
I'm curious if it is possible to move the written and fully working project
While working a project tonight, I ended up using one .js resource file for
I working on project and have problem with threading and update of UI. I
I m working on project user to move the image in one position to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.