从选定的2个不同的下拉选项中将文本加载到Textarea

时间:2019-02-11 06:28:23

标签: javascript php html

  1. 我想有两个单独的下拉框(状态和销售)。
  2. 两个下拉框都需要具有单独且唯一的可选选项,然后这些选项将填充Textarea框...以便我可以将该信息提交到数据库中。

最后,我只想通过选择预先编写的文本选项来节省大量时间,然后将其推送/填充到Textarea中,以便将信息提交到数据库中。

我已经尝试了很多,只会混淆。大声笑

我试图通过创建两个下拉菜单来使其正常工作,但是一个下拉菜单使另一个下拉菜单无法正常工作……在测试期间它们都无法正常工作。

screenshot

<?php
    include('../include/admin_inc.php');
    $addstatus = new admin;
    $list = new admin;
    $adminlist= new admin;
    $custname=new admin;
    $id= $_REQUEST['id'];
    if($_REQUEST['mode']=="add")
    {
        if($_REQUEST['opstatus']!='' && $_REQUEST['status']!=" ")
        {
            $status = htmlspecialchars_decode($_REQUEST['opstatus']);
        }
        else
        {
            $status = $_REQUEST['status'];
        }   
        $view = $_REQUEST['view'];
        $closed = $_REQUEST['closed'];
        $date = date("Y-m-d");  
       $admin_name = $_SESSION['usernm'];
       $status = addslashes($status);
       $addstatus->addstotatus($id,$status,$admin_name,$view,$closed,$date);
       $last_id= mysqli_insert_id($addstatus->link_id());
       if($view=="1")
        {
            //send email to customer
            $get_details=new admin;
            $get_details->getcust($id);
            $get_details->next_record();
            $cust_email=$get_details->f("email");
            $message="<html xmlns='http://www.w3.org/1999/xhtml'>
<style type='text/css'>table {text-shadow: 2px 2px 6px rgba(75, 155, 230, 0.15); font:Bookman; font-size:16px;}</style>
                       <body>
                            <table width='100%' cellspacing='8' cellpadding='0'>
                              <tr>
                                <td valign='left' style='font-size: small'>DON'T RESPOND TO THIS EMAIL. Only Send emails to <strong>Contact@NO.Comm</strong> - Remove ANY CC's<br /><br />
                                </td>
                              </tr>                           
                              <tr>
                                <td valign='left'><strong>The status of your case has been updated, see message below.</strong><br />
                                <br /><br />
                                </td>
                              </tr>                       
                               <tr bgcolor='f3feff'>
                                <td valign='top'><strong>".stripslashes($status)."</strong></td>
                              </tr>
                              <tr>
                                <td valign='top'>
                                <br>
                                <strong>My Case ID is ".stripslashes($id)."</strong>
                                <p>Check the progress of your case, goto <a href='http://www.NO.com/status/trackonline.php'>Check Status of My Case Online</a>, enter your 6 Digit Customer #.
                                <br /><br />
                                </p>
                                <p>Thank you,<br><br>ABD Corp.</p>
                                </td><br />
                              </tr>
                             </table>
                            </body>
                            </html>"; 
        include("../class.phpmailer.php");
        $mail = new PHPMailer();
        $mail->From = "no@no.com"; 
        $mail->FromName = "ABC Corp";
        //$mail->AddAddress("no@no.com");
        $mail->AddAddress($cust_email);
        $mail->AddAddress("no@no.com");
        $mail->Subject = "ABC Corp. Status Update For $id";
        $mail->Body = $message;
        $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
        $mail->IsHTML("true");
        $mail->Send();
            //end of email
        }
        $addstatus->firststatusadd($last_id,$admin_name,$status,$date);
        $adminid=$_REQUEST['admin'];
        $assignned_by=$_SESSION['ses_user_id_sky'];
        //echo $assignned_by;
        $adminlist->addtodo($adminid,$last_id,$assignned_by,$id);
    }
if($_REQUEST['i']=='1')
{
?>
<script language="javascript">
    window.close();
    window.opener.location.href = "edit_customer.php?id=<?php echo $id;?>";
</script>
<?php
}
$custname->getcust($id);
$custname->next_record();
?>
<html>
  <head>
    <title>Untitled Document</title>
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    <script language="JavaScript" type="text/javascript" src="editor/scripts/wysiwyg.js"></script>
    <script language="JavaScript" type="text/javascript" src="editor/scripts/wysiwyg-settings.js"></script>
    <script language="javascript1.2">
      // attach the editor to the textarea with the identifier 'textarea1'.
      WYSIWYG.attach('status');
    </script>
    <script language="javascript">
      function check() {
        return true
      }

      function getCountry(c) {
        if (c != "") {
          document.getElementById("textshow").style.display = "";
          var b = c;
          this.a.value.display;
          alert(b)
        }
      }

      function clearvalue() {
        document.frm.mode.value = "";
        document.frm.submit()
      };
    </script>

    <style>
      .options td {
        float: left;
        padding: 5px 5px 0;
      }

      .options select {
        margin: 4px 0 0;
      }

      .button {
        border-radius: 2px;
        background-color: #0099CC;
        border: none;
        color: #FFFFFF;
        font-size: 20px;
        padding: 7px;
        width: 115px;
        transition: all 0.7s;
        cursor: pointer;
      }

      .button span {
        cursor: pointer;
        display: inline-block;
        transition: 0.7s;
      }

      .button span:after {
        content: '\270C';
        font-size: 20px;
        margin: .35em;
        opacity: 0;
        transition: 0.7s;
      }

      .button:hover span {
        padding-right: 15px;
      }

      .button:hover span:after {
        opacity: 1;
        right: 0;
      }
    </style>

    <form name="frm" method="POST" action="<?php print $PHP_SELF; ?>" onSubmit="return check()">
      <input type="hidden" name="mode" value="add">
      <input type="hidden" name="id" value="<?php echo $_REQUEST['id']; ?>">
      <input type="hidden" name="statusvalue" value="<?php echo htmlspecialchars($_REQUEST['opstatus']); ?>">
      <?php
                $custstatus = new admin;
                $custstatus->getstatus($id);
                if($custstatus->num_rows() > 0)
                {
                $custstatus->next_record();
                }
?>

  </head>

  <body>
    <table align="center" cellpadding="1" cellspacing="1">
      <tr>
        <td align="left">
          <font size="4"><strong>Add Status for</strong> "<strong><?php echo stripslashes($custname->f('fname'));?></strong> <strong><?php echo stripslashes($custname->f('lname'));?></strong>"</font>
          <font size="+1">
            <font color="#0066FF"><strong><?php echo $id;?></strong></font>
          </font>
          <font size="+1"> |
            <font color="Green"><strong><?php echo stripslashes($custname->f('phno'));?></strong></font>
          </font>
          <br><br></td>
      </tr>
      <?php
    $name=$_SESSION['usernm'];
/*  $adminlist->adminall($name);
    $adminlist->next_record();*/
    /*if($adminlist->f('id')=='1')
    {*/
?>






      <tr>
        <td>

          <select name="opstatus" onChange="clearvalue()" style="overflow:auto; overscroll-behavior:contain; width:545px; background-color:#6F9">

            <option value="">STATUS</option>
            <?php $list->listjobstatus(); while($list->next_record()){?>
            <option value="<?php echo htmlspecialchars($list->f('status')); ?>">
              <?php echo strip_tags($list->f('status')); ?>
            </option>
            <?php }?>

          </select>



          <tr>
            <td>&nbsp;</td>
          </tr>


          <tr>
            <td>
              <select name="admin" style="overflow: auto; overscroll-behavior: contain; width:545px; background-color:#CCC">
                <option>To Do, Select Employee You Will Assign a "To Do"</option>
                <?php
    $adminlist->alladmin();
    while($adminlist->next_record())
    {
    /*if($adminlist->f('status')!='1')
    {*/
?>
                <option value="<?php echo $adminlist->f('id'); ?>" <?php if($_REQUEST[ 'admin']==$adminlist->f('id')) { echo "selected"; } ?>>
                  <?php  echo $adminlist->f('first_name')."&nbsp;".$adminlist->f('last_name'); ?>
                </option>
                <?php
    //} 
    }
?>
              </select>

              <tr id="textshow">
                <td colspan="2"><br>
                  <font size="3"><strong>Status Of Job:</strong></font><br><textarea name="status" id="status"><?php echo $_REQUEST['opstatus']; ?></textarea></td>
              </tr>

              <tr class="options">
                <td colspan="2"><strong>Publicly Visible: </strong>
                  <select name="view">
                    <option value="1">Yes</option>
                    <option value="0" selected>No</option>
                  </select> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <strong>Status Closed: </strong>
                  <select name="closed">
                    <option value="1">Yes</option>
                    <option value="0" selected>No</option>
                  </select>
                </td>
              </tr>

              <tr>
                <td>&nbsp;</td>
              </tr>

              <tr>
                <td colspan="2" align="left">
                  <table>
                    <tr>
                      <td>
                        <button class="button"><span>Submit</span></button></td>
                    </tr>
                  </table>
                </td>
              </tr>
    </table>
    </form>
  </body>
  </html>

0 个答案:

没有答案