بررسی یک فایل php

mojtabaivi

New Member
سلام دوستان. من میخوام ببینم این فایل پی اچ پی مشکل خاصی داره که اجرا نمیشه؟ چه از لحاظ نگارشی و چه دستوری
[PHPS]
<?php
$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_message = $_POST['message'];
$contact_subject = $_POST['subject'];


if($contact_name == true)


$sender = $contact_email;
$receiver = "[email protected]";
$client_ip = $_SERVER['REMOTE_ADDR'];
$email_body = "Name : $contact_name \nEmail:$sender \n Subject:$contact_subject \nMessage : $contact_massege \n IP:$client_ip \n go to http://www.hi-design.ir";
$extra = "From : $sender \r\n" . "Reply-To: $sender \r\n" . "X-Mailer:pHP/" .phpversion();
if(mail($receiver,"Flash Contact Form - $subject",$email_body,$extra))
{
echo "success=yes";
}
else {
echo "success=no";
}
?>
[/PHPS]

در ضمن قبلش سه متغیر name و email و message بهش داده میشه
 

ahmad_m1234

Active Member
فکر می کنم شرط if اولی مشکل داره ، قابلیت نمایش اررور تو php.ini فعال کن ببین از چی داره خطا میگیره
 

bestdata

Active Member
[PHPS]

Notice: Undefined index: name in C:\xampp\htdocs\chat\index.php on line 2

Notice: Undefined index: email in C:\xampp\htdocs\chat\index.php on line 3

Notice: Undefined index: message in C:\xampp\htdocs\chat\index.php on line 4

Notice: Undefined index: subject in C:\xampp\htdocs\chat\index.php on line 5

Notice: Undefined variable: sender in C:\xampp\htdocs\chat\index.php on line 14

Notice: Undefined variable: contact_massege in C:\xampp\htdocs\chat\index.php on line 14

Notice: Undefined variable: sender in C:\xampp\htdocs\chat\index.php on line 15

Notice: Undefined variable: sender in C:\xampp\htdocs\chat\index.php on line 15

Notice: Undefined variable: subject in C:\xampp\htdocs\chat\index.php on line 16
success=yes[/PHPS]
نتیجه اجرا
 

ahmad_m1234

Active Member
مقدار contact_massege مگه نام نیست چرا true گزاشتی ، اگه ارسال ویندوز خودتون می خواهید ارسال کنید اینجوری ارسال نمیشه
 

جدیدترین ارسال ها

بالا