让我们去点,
我有一个像这样的表格
exhibition.php
<?php
include("email_class.php");
if(isset($_POST[SAVE])){
$email = $_POST[EMAIL];
$company = $_POST[COMPANY];
$gender = $_POST[GENDER];
$buyer = $_POST[BUYER];
$discussion = $_POST[DISCUSSION];
$class = new email_class();
$class->notifikasi($discussion);
}//end if
?>
代码包含这样的文件
email_class.php
<?php
class email_class{
function notifikasi($discussion){
if($discussion == "DISCUSSION"){
$to = $email;
$subjek = "Thanks for visiting us at Gulfood exhibition, Dubai";
$message = "<html>
<head>
<title>Exibithion Email</title>
</head>
<body>
bla blaa";
$message.= "Dear <b> ".$gender." ".$buyer."</b><br><br>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: **** Group <export@***>' . "\r\n";
echo $message;
}//end if
}//end function
}//end of class
?>
好的,回复HTML邮件是Succees。任何事情都运行良好,只有来自exhibition.php的变量不能传递给email_class.php。
任何人都可以解决我的问题吗?
答案 0 :(得分:1)
将值作为参数传递给notifikasi
。
<?php
include("email_class.php");
if(isset($_POST[SAVE])){
$class = new email_class();
$class->notifikasi($_POST[EMAIL], $_POST[COMPANY], $_POST[GENDER], $_POST[BUYER], $_POST[DISCUSSION])
}//end if
?>
上课
class email_class{
function notifikasi($email, $company, $gender, $buyer, $discussion){
if($discussion == "DISCUSSION"){
/** ... **/