自动

时间:2015-12-15 10:11:34

标签: javascript php jquery html

我要做的就是当你点击assortiment - >玫瑰。 http://binnenkijkenbij.nl/happycolors/roses.html 你看到一个带有玫瑰的页面,当你点击玫瑰时,它会弹出一个灯箱。 在照片下方,您可以联系该公司。

我想为每朵花添加一个自定义主题。所以,如果我点击第一个Rose并点击联系我们。必须出示联系表格,或者我会前往联系页面,在该联系页面上主题自动填充花卉名称。

有谁知道如何解决这个问题?我知道一些小的php / javascript但是,此时我已经卡住..我有简单的联系方式,你可以自己添加一个主题。

HTML:

<div class="divide50"></div>
  <div class="row">
    <div class="col-sm-8">
      <h1 class="post-title">Feel free to contact us</h1>
      <p></p>
      <div class="divide20"></div>
      <div class="form-container">
        <div class="response alert alert-success"></div>
        <form class="forms" action="contact/form-handler.php" method="post">
          <fieldset>
            <ol>
              <li class="form-row text-input-row name-field">
                <input type="text" name="name" class="text-input defaultText required" title="Name (Required)"/>
              </li>
              <li class="form-row text-input-row email-field">
                <input type="text" name="email" class="text-input defaultText required email" title="Email (Required)"/>
              </li>
              <li class="form-row text-input-row subject-field">
                <input type="text" name="subject" class="text-input defaultText" title="Subject"/>
              </li>
              <li class="form-row text-area-row">
                <textarea name="message" class="text-area required"></textarea>
              </li>
              <li class="form-row hidden-row">
                <input type="hidden" name="hidden" value="" />
              </li>
              <li class="nocomment">
                <label for="nocomment">Leave This Field Empty</label>
                <input id="nocomment" value="" name="nocomment" />
              </li>
              <li class="button-row">
                <input type="submit" value="Submit" name="submit" class="btn btn-submit bm0" />
              </li>
            </ol>
            <input type="hidden" name="v_error" id="v-error" value="Required" />
            <input type="hidden" name="v_email" id="v-email" value="Enter a valid email" />
          </fieldset>
        </form>
      </div>
      <!-- /.form-container --> 
    </div>

PHP:

<?php
include('SMTPClass.php');

$use_smtp = '0';
$emailto = 'myemail@domein.com';

// retrieve from parameters
$emailfrom = isset($_POST["email"]) ? $_POST["email"] : "";
$nocomment = isset($_POST["nocomment"]) ? $_POST["nocomment"] : "";
$subject = 'Contactformulier Happy Colors';
$message = '';
$response = '';
$response_fail = 'There was an error verifying your details.';

    // Honeypot captcha
    if($nocomment == '') {

        $params = $_POST;
        foreach ( $params as $key=>$value ){

            if(!($key == 'ip' || $key == 'emailsubject' || $key == 'url' || $key == 'emailto' || $key == 'nocomment' || $key == 'v_error' || $key == 'v_email')){

                $key = ucwords(str_replace("-", " ", $key));

                if ( gettype( $value ) == "array" ){
                    $message .= "$key: \n";
                    foreach ( $value as $two_dim_value )
                    $message .= "...$two_dim_value<br>";
                }else {
                    $message .= $value != '' ? "$key: $value\n" : '';
                }
            }
        }

    $response = sendEmail($subject, $message, $emailto, $emailfrom);

    } else {

        $response = $response_fail;

    }

echo $response;

// Run server-side validation
function sendEmail($subject, $content, $emailto, $emailfrom) {

    $from = $emailfrom;
    $response_sent = 'Thank you. Your messsage has been received.';
    $response_error = 'Error. Please try again.';
    $subject =  filter($subject);
    $url = "Origin Page: ".$_SERVER['HTTP_REFERER'];
    $ip = "IP Address: ".$_SERVER["REMOTE_ADDR"];
    $message = $content."\n$ip\r\n$url";

    // Validate return email & inform admin
    $emailto = filter($emailto);

    // Setup final message
    $body = wordwrap($message);

    if($use_smtp == '1'){

        $SmtpServer = 'SMTP SERVER';
        $SmtpPort = 'SMTP PORT';
        $SmtpUser = 'SMTP USER';
        $SmtpPass = 'SMTP PASSWORD';

        $to = $emailto;
        $SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body);
        $SMTPChat = $SMTPMail->SendMail();
        $response = $SMTPChat ? $response_sent : $response_error;

    } else {

        // Create header
        $headers = "From: $from\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-type: text/plain; charset=utf-8\r\n";
        $headers .= "Content-Transfer-Encoding: quoted-printable\r\n";

        // Send email
        $mail_sent = @mail($emailto, $subject, $body, $headers);
        $response = $mail_sent ? $response_sent : $response_error;

    }
    return $response;
}

// Remove any un-safe values to prevent email injection
function filter($value) {
    $pattern = array("/\n/", "/\r/", "/content-type:/i", "/to:/i", "/from:/i", "/cc:/i");
    $value = preg_replace($pattern, "", $value);
    return $value;
}

exit;

?>

0 个答案:

没有答案