Search code examples
phpformsmailer

contact form in email not returning values


I'm using CKEditor to create a html mailer in which a contact form is being sent to email.
The problem is, there is no value being received on submission of that form in email.

Contact Form in E-Mail (code)

<form action="http://techindiainfotech.com/mail.php" method="post" name="test">
    <p>Your Name: <input maxlength="75" name="name" size="75" type="text" /></p>

    <p>Mobile Number: <input maxlength="10" name="mobile" size="10" type="text" /></p>

    <p>Business Name: <input maxlength="100" name="business" size="100" type="text" /></p>

    <p><input name="sub" type="submit" value="Submit" /></p>
</form>

Handler - mail.php

if ($_POST['sub'] != '') {
    unset($_POST['sub']);
    echo "Details received:<br>";
    foreach ($_POST as $val) {
        echo "$val<br>";
    }
} else {
    header("Location: http://www.techindiainfotech.com/files/contact_us.php");
    exit();
}

Screenshot from gmail's Message Text Garbled

Message Text Garbled


Solution

  • Everything was fine except for the one, the form action attribute.
    I'm submitting the form to http://techindiainfotech.com/mail.php but due to .htaccess it is being redirected to http://www.techindiainfotech.com/mail.php and that's why the request has been lost (I'm not getting the appropriate word here).

    So, I just need to change in my action attribute which is, submit my form to http://www.techindiainfotech.com/mail.php not to http://techindiainfotech.com/mail.php.