0

従来の sendeail.php フォームに新しいアイテムを追加しようとしています。ただし、php リストとメール配信に新しいアイテムを追加すると、送信されるメールにまったく表示されません。少なくともメールは送信されています... ラジオとチェック ボックスの項目を改良する必要があることはわかっていますが、新しい項目はどれも表示されません。新しいアイテムは、すぐ下のコード リストの $attn 以降のすべてのアイテムです。ありとあらゆる助けをいただければ幸いです。どうもありがとうございました。

私のPHPコードは次のとおりです。

<?php

$ip = $_POST['ip']; 
$httpref = $_POST['httpref']; 
$httpagent = $_POST['httpagent']; 
$visitor = $_POST['visitor']; 
$visitormail = $_POST['visitormail']; 
$notes = $_POST['notes'];
$attn = $_POST['attn'];
$phone = $_POST['phone'];
$interest = $_POST['interest'];
$budget = $_POST['budget'];
$budget = $_POST['day'];
$timeslot = $_POST['timeslot'];

if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) 
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n"; 
$badinput = "<h2>Please complete all the fields.</h2>\n";
echo $badinput;
die ("Use the Back button on your browser...");
}

if(empty($visitor) || empty($visitormail) || empty($notes )  || empty($attn )  || empty($phone )) {
echo "<h2>Please click Back and fill in all fields.</h2>\n";
die ("Use the Back button on your browser... "); 
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ; 
$subject = $attn; 

$notes = stripcslashes($notes); 

$message = " $todayis [EST] \n
Web Site Request About: $attn \n
From: $visitor ($visitormail)\n
Phone: $phone \n
Message: $notes \n 
Interested In: $interest \n
Heating Budget: $budget \n
Time Availability: Days - $day \n
Time Availability: Morning or Afternoon - $timeslot \n


Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("XXXXX", $subject, $message, $from);

?>

そして私のHTMLコードは次のとおりです。

<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
        <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
        <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
        <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
        All fields are required.</p>
      <p align="left">Your Name:
        <input type="text" name="visitor" size="35" />
        </p>
      <p align="left">
        Your Email:  
          <input type="text" name="visitormail" size="35" />
        </p>
      <p align="left">
        <label for="Phone">Your Phone: </label>
        <input type="text" name="Phone" id="Phone" size="35"/>
      </span></p>
      <p align="left">
        About:
        <select name="attn" size="1">

select name="interest" id="interest">
          <option value="General Query">General question</option>
          <option value="Plumbing Query">Plumbing</option>
          <option value="Gasfitting Query">Gasfitting</option>
          <option value="Central Heating Query">Central Heating</option>
          <option value="Custom Work Query">Several options</option>
          </select>
        <br />

  <p align="left">Your Home Heating Budget:

    <select name="attn2" size="1">


select name="budget" id="budget">
      <option value="Under 10000">$8000 to $10,0000</option>
      <option value="10 to 12 Thousand">$10,000 to $12,000</option>
      <option value="12 to 15 Thousand">$12,000 to $15,000</option>
      <option value="+15000 Plus">$15,000 +</option>
      </select>
    <br />
    <p align="left">Are you considering other forms of heating? 
    <input type="checkbox" name="Yes-OtherFormsHeating" id="Yes-OtherFormsHeating" />
    <label for="Yes">Yes</label>
     <input type="checkbox" name="No-OtherFormsHeating" id="No-OtherFormsHeating" />
    <label for="No">No</label>
    <br />
    </p>
    <p align="left">Please give us a few details about your home and requirements: <br />
      <textarea name="notes" rows="6" cols="70"></textarea>
    </p>


    <p align="left">To give you a quote for gas central heating, we need to visit your home. What is a good day and time for us to come to you? Choose one option.</p>
    <p align="left">
      <input type="radio" name="day" id="day_M" value="M" />
      <label for="M">M</label>
      <input type="radio" name="day" id="day_T" value="T" />
      <label for="T">T</label>
      <input type="radio" name="day" id="day-W" value="W" />
      <label for="W">W</label>
      <input type="radio" name="day" id="day_Th" value="Th" />
      <label for="Th">Th</label>
      <input type="radio" name="day" id="day_F" value="F" />
      <label for="F">F</label>
    </p>
    <p align="left">When is a good time on this day for us to come to you? Choose one or both.</p>
    <p align="left">
      <input type="checkbox" name="timeslot" id="8:30-12:30AM" />
      <label for="8:30-12:30AM">8:30 - 12:30</label>
      <input type="checkbox" name="timeslot" id="12:30-4" />
      <label for="12:30-4">12:30 - 4:00</label>
    </p>
4

1 に答える 1

0

まず第一に、常に入力を検証します( POST)。すでにいくつかの基本的な検証を行っていますが、POSTデータに関するセキュリティへの影響について読んでください。

PHP の配列キーは大文字と小文字が区別されます。$_POST['phone']と同じではありません$_POST['Phone']

selectタグが壊れています。投稿された のカラーリングを見てくださいhtml

$budget意図したデータを上書きして、2 回宣言しました。

$budget = $_POST['budget'];
$budget = $_POST['day'];

checkboxesは投稿時に配列である必要があります。name属性をthename[]単に ではなく に変更してthenameください。もちろん、php スクリプトは、この変更後の結果の配列を処理する必要があります。

于 2013-04-23T12:49:33.287 に答える