1

我正在尝试创建三种形式。它应该工作的方式是应该出现一个表单并且用户能够输入他们的信息。按下提交按钮后,应向主管发送一封电子邮件,主管应单击链接,然后会出现另一个表单。当主管填写表格然后点击提交时,应向客户提交一封电子邮件。客户将点击链接并填写表格。然后,客户应该能够向员工发送电子邮件,主管和原始用户都应该能够得到回复。但是,当我继续创建表单时,php 在第二个表单之后不断中断。我似乎无法弄清楚为什么它一直以第三种形式出现。

这是第二种形式的 php 代码片段:

    if ($_POST['token'] == "2") {
     $m = new mysql($connection_information);
     $m->update('hello',array('approval'=>$_POST['approval'], 
'comment'=>$_POST['comment'], 
'approved_by'=>$_POST['approval_by'],
'approved_date'=>time()),'uid=\''.$_POST['uid'].'\'');
$records = $m->row(array('table' => 'hello','condition' => 'uid=\''.$_POST['uid'].'\''));

$eemail = records['email'];
$supemail = $records['supervemail'];
$clemail = $records['cemail'];
$approvaltime = date("m/d/y g:i a",$records['approved_date']);


$subject = " " . $clemail;
$headers = 'From: ' . $supemail . "\r\n" .
    'Reply-To: ' . $supemail . "\r\n" .
    'MIME-Version: 1.0' . "\r\n";

if($records['approval'] == 1){
    $travel_action = 'approved';
}else{
    $travel_action = 'rejected';
}

$message = " Travel Estimation  ".$travel_action." on ".$approvaltime." by ".$records['approved_by']. "\r\n" . "Comment: " .$records['comment']. "\r\n";
mail($eemail, $subject, $message, $headers);

这是我的html部分:

      <?php if ($_POST['token'] == "2") { ?>
      <h1>Approval Decision Submited.</h1>
      <?php } else if ($_POST['token'] == "1") {
       echo "<h1>Form has been submitted</h1>";
     } else {

 if (isset($_GET['uid']) && isset($records)){

       ?>
    <form id="approvalForm" name="form2" action="hello.php" method="POST">
    <input type="hidden" name="token" value="2">
    <input type="hidden" name="uid" value="<?php echo $_GET['uid'] ?>">
    <fieldset>
        <legend>Manager Approval Required</legend>
        Submitted on: <?php echo date("m/d/y g:i a",$records['submitted'])                         ?><br/>
        By: <?php echo $records['email'] ?><br/>
        <label for="email">Supervisor's Email: </label>
        <input type="text" name="email" title="Email" value="<?php echo $records['supervemail'] ?>"><br>
         <label for="email">Client's Email: </label>
        <input type="text" name="email" title="Email" value="<?php echo $records['supervemail'] ?>"><br>
        <label for="email">Employee's Email: </label>
        <input type="text" name="email" title="Email" value="<?php echo $records['supervemail'] ?>"><br>
        <label for="approval_by">Please Enter your name for approval: </label>
        <input type="text" name="approval_by" id="approval_by" title="Approved By" ><br>
        <label for="approval">Please select appropriate action: </label>
        <select name="approval" id="approval">
          <option value="">Please Select Action</option>
          <option value="1">Approval</option>
          <option value="0">Rejection</option>
        </select>
        <label for="comment" >Comment: </label>
        <input type="text" name="comment" id="comment" title="comment"><br>

        <input class="submit" type="submit" value="Submit"/>
    </fieldset>
</form>

在我的第三种表格中,我希望主管向客户发送一封电子邮件,以便客户收到链接并在第三种表格中批准或不批准。如果他们同意或不同意,他们可以从那里向用户提交电子邮件。我做到了,所以第三种形式看起来与第二种形式几乎相同。这就是我的错吗?

4

1 回答 1

1

我注意到 eemail 变量的记录数组没有美元符号。

$eemail = records['email'];

应该

$eemail = $records['email'];
于 2012-07-11T19:40:53.227 回答