表单提交后缺少css文件

时间:2015-06-08 12:38:39

标签: javascript php html css cakephp

我创建了一个表单来发送文本。我在表单提交后使用不同的控制器和操作重定向页面。每当我提交表单时,我正在使用的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));
        }
    }

提前致谢。

2 个答案:

答案 0 :(得分:1)

检查您的布局文件或类似包含css文件的文件。

答案 1 :(得分:0)

我使用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"/>

当我写redirect.html时,我从索引页面复制并粘贴了头部。它包含styles.css的链接,如下所示:

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

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

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

所以我编辑了redirect.html的标题以更正我的style.css的路径,如下所示,表示走出/ cgi-bin并返回/ css:

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

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