Hello,

I have this codes:

    <div id="contactform">


  <div id="contactform">


     <?php
require_once('recaptchalib.php');
$error = array();
$name = strip_tags(@$_POST['name']);
$email = str_replace(" ", "", strip_tags(@$_POST['email']));
$phone = str_replace(" ", "", strip_tags(@$_POST['phone']));
$message = strip_tags(@$_POST['message']);
if (isset($_POST['submit']))
{
if( ($name !='') && ($email !='') && ($phone!='') && is_numeric($phone) && ($message !='' ) )
{
$privatekey = "6LdRStUSAAAAABctjZq_iX249auG_kjaNvn_4vfN";
$resp = recaptcha_check_answer($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid)
{
//What happens when the CAPTCHA was entered incorrectly
echo "The reCAPTCHA wasn't entered correctly.";
}
else
{
//Your code here to handle a successful verification
ini_set("SMTP", "smtp.mail.yahoo.com"); //smtp require's validations
echo "Thank you.  The email has been sent.";
}
}
else
{
//validation's
foreach( $_POST as $key => $val)
{
if($key == "phone" && $val !="" )
{
if(!is_numeric($val)){
$error[$key] = $key ;
}
}
if($val == "" || !isset($_POST[$key]) )
{
$error[$key] = $key;
}
}
}
}
else {
echo "Please fill in <b>all</b> the fields!";
}

?>



    <div id="form">
    <form name="contact" action="contact2.php" method="POST">
    <table>
    <tr>
    <td>
    <font color="red">*</font> = Required
    </td>
    </tr>
    <tr>
    <td>
    Nama <font color="red">*</font>:
    </td>
    <td>
    <input type="text" name="name" size="30" value="<?php echo $name; ?>">
    </td>
    </tr>
    <tr>
    <td>
    Email <font color="red">*</font>:
    </td>
    <td>
    <input type="text" name="email" size="30" value="<?php echo $email; ?>">
    </td>
    </tr>
    <tr>
    <td>
    No Telp. <font color="red">*</font>:
    </td>
    <td>
    <input type="text" name="phone" size="30" value="<?php echo $phone; ?>">
    </td>
    </tr>
    <tr>
    <td>
    Pesan <font color="red">*</font>:
    </td>
    <td>&nbsp;

    </td>
    </tr>
    <tr>
    <td>&nbsp;

    </td>
    <td>
    <textarea name="message" cols="30" rows="5" style="resize:none" wrap="off"><?php echo $message; ?></textarea>
    </td>
    </tr>
    <tr>
    <td>&nbsp;

    </td>
    </tr>
    <tr>
    <td>&nbsp;

    </td>
    <td>
    <?php
    $publickey = "6LfjvdcSAAAAAAPiwMdbpISXqWNuUeVCSs_kpK__";
    echo recaptcha_get_html($publickey);
    ?>
    </td>
    </tr>
    <tr>
    <td>&nbsp;

    </td>
    <td>
    <input type="image" name="submit" src="images/button-kirim.jpg" height="30px" width="70px" alt="Submit details" /> 
    <!-- <input type="submit" name="submit" value=" Send "> -->
    </td>
    </tr>
    </table>
    </form>

If you fill-in the contact form. Nothing happen - it only take us to the next page - contact2.php I receive no e-mail what so ever.

What should I do to fix this?

Member Avatar for LastMitch

If you fill-in the contact form. Nothing happen - it only take us to the next page - contact2.php I receive no e-mail what so ever.

I don't see anything wrong with your contact form (current). The issue is before your second contact form. You submiting 2 contact form? So the issue is the first one.

Look at your form again. Your action is "contact2.php" so, when the submit image is
clicked, the validation code at the top of the page is ignored and the content of the
form is sent to the target of the "action".

You can use the google drive contact form. It is best because it arrange perfectlly in the excellsheet so you can use it.

just remove contact2.php form action in form tag and see then test your code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.