这就是我所拥有的::
<form action="" method="post">
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
<input type="hidden" name="email" value="<?php echo $email; ?>"/><br/>
<strong>Applicant ID:</strong> <?php echo $id; ?><br />
<strong>Applicant name: </strong>
<input type="text" name="username" readonly value="<?php echo $lastname. "," . $firstname. " " .substr($middlename, 0,1); ?>"/><br/>
<strong>Username: </strong><input type="text" readonly name="username" value="<?php echo $username; ?>" /> <br />
<strong>Password: </strong><input type="text" readonly name="password" value="<?php echo $password; ?>" /> <br />
<strong>Manage Application: </strong><select name="status">
<?php
$selection = array(
0 => "Pending",
1 => "Approve",
2 => "Revoke" );
foreach($selection as $key => $value)
{
echo '<option value="' . $key . '"';
if ($status == $key)
echo ' selected="selected"';
echo '>' . $value . '</option>';
echo ' <br />';
}
?>
</select>
<br />
<button type="submit" name="submit" value="Submit"><img src="../../images/login.png" />Update</button>
<?php
if(isset($_POST['submit']))
{
if($value == 'Approve'){
$to = $_POST['email'];
//define the subject of the email
$subject = 'BCE Scholars Application Notification';
//define the message to be sent. Each line should be separated with \n
$message = "Congratulations! Your application is approved.";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: bcescholar@yahoo.com\r\nReply-To: bcescholar@yahoo.com";
//send the email
if (mail($to, $subject, $message, $headers)) {
echo("<p>Congrats!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
}
if($value == 'Revoke')
{
$to = $_POST['email'];
//define the subject of the email
$subject = 'BCE Scholars Application Notification';
//define the message to be sent. Each line should be separated with \n
$message = "Sorry your application is revoked.";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: bcescholar@yahoo.com\r\nReply-To: bcescholar@yahoo.com";
//send the email
if (mail($to, $subject, $message, $headers)) {
echo("<p>Congrats!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
}
} // end of if button pressed
?>
<a href="../index.php"><button type="button"><img src="../../images/back.png"/>Back</button></a>
</div>
</form>
我的网站正在向其申请人发送电子邮件通知。如果管理员从组合框中选择了批准,它会自动发送一封电子邮件,否则也会发送一封电子邮件通知申请人他的申请已被撤销/拒绝。但我的问题是它没有进入 APPROVE if ($value == 'Approve') 语句。它总是进入 REVOKE 语句。这有什么问题?请帮忙。谢谢。