0

Hello,

In my contact us I just add project combo box, yet I do not feel the programming for information form capturing is correct (after I add the project combo box), if anyone can help me would be great.

Thanks before.

contactus.php

<div id="contactform">

      <?php
    require_once('recaptchalib.php');
    $name = strip_tags(@$_POST['name']);
    $email = str_replace(" ", "", strip_tags(@$_POST['email']));
    $phone = str_replace(" ", "", strip_tags(@$_POST['phone']));
    $project = strip_tags(@$_POST['project']);
    $message = strip_tags(@$_POST['message']);
    if (@$_POST['submit']) {
    if ($name&&$email&&$phone&&$project&&$message) {
    if (is_numeric($phone)) {
    $privatekey = "6LfjvdcSAAAAAHNcKjYO5DhTNefxYZHYcfhtrvGC";
    $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");
    $body = "
    Name: ".$name."
    Phone: ".$phone."
    Email: ".$email."
    Project: ".$project."\n\n
    ".$message;
    mail("davy_yg@yahoo.com", "Message from Innovation Website", $body, "From: ".$email);
    echo "Your message has been sent, we will get back to your shortly.";
    $name = trim("");
    $email = trim("");
    $phone = trim("");
    $project = trim("");
    $message = trim("");
    }
    }
    else
    echo "There should only be numbers in your phone number.";
    }
    else
    echo "Please fill in <b>all</b> the fields!";
    }
    ?>

    <div id="form">
    <form name="contact" action="<?php $_SERVER['PHP_SELF'] ?>" 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>
    <tr>
    <td>
    Type Proyek <font color="red"></font>:
    </td>
    <td>
    <select>
        <option value="Company Profile">Company Profile</option>
        <option value="Ecommerce">Ecommerce</option>
        <option value="Marketing Tools">Marketing Tools</option>
        <option value="Web Applikasi">Web Applikasi</option>
    </select>
    </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="kirim" class="button"> 
    </td>
    </tr>
    </table>
    </form>
2
Contributors
2
Replies
15
Views
3 Years
Discussion Span
Last Post by davy_yg
1

Hi,
I think you need to give your select element 'name' attribute. It should be like this:

<select name="project_type">
    <option value="Company Profile">Company Profile</option>
    <option value="Ecommerce">Ecommerce</option>
    <option value="Marketing Tools">Marketing Tools</option>
    <option value="Web Applikasi">Web Applikasi</option>
</select>

You can refer to Mozilla Guide for full explanation Click Here.

0

Thanks. I add <select name="project"> to my code. I tested the email form, it said that it already sent me an email, but when I checked my inbox, I did not receive anything.

This is strange, before I add the combo box everything works fine

----------------------

Nevermind, there is a time delay. thanks.

Edited by davy_yg: revision

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.