0
私は訪問者からの電子メール、国およびIPアドレスをCSVに取得しようとしており、サイト所有者にも電子メールを送信します。IPを持つCSV形式のデータストア:未定義のエラー
私はあまり慣れていないが、私は$cvsData .= "\"$email\",\"$ip\"".PHP_EOL;
ラインのために未定義のエラーをオフに取り除くことができ、ほとんどのものの作品を得たが、ない...
Error Message: Notice: Undefined index: ip_address in
ここでは私のコード
<?php
// this is to store form into csv file
if(isset($_POST["submit"]))
{
$email = $_POST["email"];
$ip = $_SERVER['REMOTE_ADDR'];
if(empty($email))
{
echo "ERROR MESSAGE";
die;
}
$cvsData .= "\"$email\",\"$ip\"".PHP_EOL;
$fp = fopen("emails.csv", "a");
if($fp)
{
fwrite($fp,$cvsData); // Write information to the file
fclose($fp); // Close the file
echo "<h3>Thank you! we will inform you.....</h3>";
}
}
// this is to send email to site owner
// Contact subject
$email ="$email";
// Enter your email address
$to ='[email protected]';
$subject ='site Email Submited';
$send_email=mail($to,$email,$subject);
// Check, if message sent to your email
// display message "We've recived your information"
if($send_email){
echo "Email address is sent to the department.";
} else {
echo "ERROR";
}
?>
フォームですフィールド名=「メール」と送信ボタンは1つだけです