表单提交后缺少CSS文件


css file missing after form submission

我创建了一个发送文本的表单。我用不同的控制器和动作重定向表单提交后的页面。每当我提交表单时,我正在使用的css文件"temp.css"就会丢失,仅用于该特定页面。所以我遇到了一些设计问题。谁能解释一下为什么会这样?

文本
<div  ng-init='textcontents = <?php  echo (!empty($text_info))?json_encode($text_info):'[{"0":"empty"}]'; ?>'> 
    <?php echo $this->Form->create('TwilioText', array('url' => array('controller' =>'Emailer','action' => 'text_sendmsg'),'novalidate')); ?>
    <div class="hidden">
    <?php
        $value = isset($cust_detail['customerid']) ? $cust_detail['customerid'] : '';
        echo $this->Form->input('TwilioSentText.customerid', array('type' => 'text', 'ng-model' => 'livedata.customerid', 'value' => $value));
        echo $this->Form->input('TwilioSentText.firstname', array('type' => 'text', 'ng-model' => 'livedata.firstname', 'value' => $cust_detail['firstname']));
        echo $this->Form->input('TwilioSentText.lastname', array('type' => 'text', 'ng-model' => 'livedata.lastname', 'value' => $cust_detail['lastname']));
        ?>
    </div>
    <div class="textmsg">
        <div class="textleft pull-left">
            <?php foreach ($textChat as $key => $value) {
                    if($value['msg'] == 'in'){ ?>
                        <div class="time2"> <p> <?php echo $value['formatedtime'];?> </p> </div> 
                        <div class="inbox">  <p> <?php echo $value['sent_msg'];?> </p> </div>
                    <?php } else { ?>
                        <div class="time"> <p> <?php echo $value['formatedtime'];?> </p> </div>
                        <div class="outbox"> <p> <?php echo $value['sent_msg'];?> </p> </div>
                    <?php }
                  } ?> 
        </div>
        <div class="textright pull-right">
            <div class="righttop pull-left">
                <div class="righttop_left pull-left">
                    <div class="form-group">
                        <?php
                        $value = isset($cust_detail['phone1']) ? $cust_detail['phone1'] : '';
                        echo $this->Form->input('TwilioSentText.msgSentNmbr', array('type' => 'hidden', 
                                                                                    'placeholder' => 'Phone', 
                                                                                    'label' => false, 
                                                                                    'class' => 'form-control', 
                                                                                    'div' => false, 
                                                                                    'value' => $value));
                        echo $this->Form->input('TwilioSentText.msgTitle', array('label' => false, 
                                                                                 'class' => 'text-list', 'div' => false,
                                                                                 'type' => 'select',
                                                                                 'ng-options' => "key as value.textName for (key , value) in textcontents",
                                                                                 'ng-change' => "textcontent = textcontents[textName].textDescription;",
                                                                                 'ng-model' => "textName",
                                                                                 'empty' => 'Content')); ?>
                    </div>
                        <?php 
                        $hostname            = "www." . $_SERVER['HTTP_HOST']. ".com";
                        $CRMuser             = $_SESSION['user_id'];
                        $trade               = "/trade-in-value-louisville-car-appraisal.php";
                        $schedappt           = "/salesman.php?sales_id=$CRMuser";
                        $creditapplication   = "/car-credit-approval-online-form.php";
                        $directions          = "www.kiastore.com/directions";
                        $fname               = '<# sfirstname>';
                        $laname              = '<# slastname>';
                        $callme              = '<# sphone>';
                        $emailme             = '<# semail>';
                        $mycontact           = $fname.' '.$laname.'<br>'.$callme.'<br>'.$emailme;
                        ?>
                    <div class="text_btn">
                        <input type="button" value="Trade"          class="btn-img btn-img-pos"  onclick="insertLink('<?php echo $hostname.$trade?>')">
                        <input type="button" value="Credit App"     class="btn-img btn-img-pos2" onclick="insertLink('<?php echo $hostname.$creditapplication?>')">
                        <input type="button" value="Inventory Link" class="btn-img btn-img-pos3" onclick="insertLink('<?php echo $hostname?>')">
                    </div>
                </div>
                <div class="righttop_right pull-left">
                    <div class="form-group" >
                        <?php
                        echo $this->Form->input('', array('label' => false, 
                                                          'class' => 'text-list', 
                                                          'div' => false,
                                                          'type' => 'select',
                                                          'empty' => 'Current Deals')); ?>
                    </div>
                    <div class="text_btn">                    
                        <input type="button" value="Sched Apt"   class="btn-img btn-img-pos"   onclick="insertLink('<?php echo $hostname.$schedappt ?>')">
                        <input type="button" value="Directions"  class="btn-img btn-img-pos2"  onclick="insertLink('<?php echo $directions ?>')">
                        <input type="button" value="My Contact"  class="btn-img btn-img-pos3"  onclick="insertLink('<?php echo $mycontact; ?>')" id="text_list">
                    </div>
                </div>
            </div>
            <div class="rightbottom pull-left">
                <?php 
                echo $this->Form->textarea('TwilioSentText.sent_msg', array('placeholder' => 'Text Content',
                    'ng-model' => 'textcontent', 'label' => false, 'id' => 'nwtext', 'class' => 'form-control', 'div' => false, 'value' => ''));
                echo $this->Form->input('TwilioSentText.url',array('type' => 'hidden', 'value' => $url));
                echo $this->Form->submit('Send',array('class' => 'btntext_send',  'id' => 'btntext_send','div' => false,'name'=>'submit'));
                echo $this->Form->submit('Schedule',array('class' => 'btntext_schd','div'=>false,'name'=>'submit'));
                echo $this->Form->end(); 
                ?>            
              </div>
            <span id="btntxt">Or Press Enter</span>
        </div>
    </div>
</div>
控制器

public function text_sendmsg() {
        if ($this->request->data['submit'] == 'Schedule') {
            if (($this->request->is('post'))) {
                $this->autoSendText();
                $this->Session->setFlash('Text to be sent has been scheduled');
            } else {
                $this->Session->setFlash('Failed');
            }
            return $this->redirect(array('controller' => 'Todolist', 'action' => 'index'));
        } elseif (($this->request->data['submit'] == 'Send')) {
            $url = explode('edit/',$this->request->data['TwilioSentText']['url']);
            $rurl = explode('-',$url[1]);
            $cust_id = $rurl[0].'-'.$rurl[1].'-31/formmini';
            if ($this->request->is('post')) {
                $send = $this->sendTextMsg();
                if($send == 1)
                    $this->Session->setFlash('Saved Successfully');
                else
                    $this->Session->setFlash('Customer Text disabled');
            }else{
                $this->Session->setFlash('Failed to send');
            }
            return $this->redirect(array('controller' => 'Customers','action' => 'edit/'.$cust_id));
        }
    }

检查您的布局文件或像这样包含css文件。

我用FormMail脚本在我的网站上嵌入了一个表单。

在我的服务器的根文件夹中,我有以下结构:

/index.html

/redirect-page.html

/css/styles.css

/cgi-bin/FormMail.pl

我的索引页包含有重定向输入的表单:

<input type="hidden" name="redirect" value="http://www.my.domain/redirect-page.html"/>

当我写重定向。html时,我复制并粘贴了索引页的标题。它包含了到styles.css的链接,如下所示:

<link href="css/styles.css" rel="stylesheet" type="text/css">

表单提交工作正常,我被重定向到重定向。html,但是重定向。html没有链接到css/styles.css.

我意识到redirect.html是从/cgi-bin中的FormMail.pl文件加载的,链接引用在同一文件夹中寻找styles.css。

所以我编辑了重定向。html的标题,以纠正我的style.css的路径,如下所示,以表明从/cgi-bin返回到/css:

<link href="./css/template.css" rel="stylesheet" type="text/css">

之后,redirect.html链接到styles.css.