表单提交后css文件丢失

时间:2023-01-17 23:43:59

I created a form to send text. I redirected the page after form submission with different controller and action. Whenever I submit a form, the css file "temp.css" which I am using is missing for that particular page alone. So that I am getting some design issues. Can anyone explain why this happens.

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

TEXT
<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>

Controller

调节器

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));
        }
    }

Thanks in advance.

提前致谢。

2 个解决方案

#1


1  

Check your layout file or like this which includes the css file.

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

#2


0  

I embedded a form on my website with FormMail script.

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

In the root folder of my server I have the following structure:

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

/index.html

/index.html

/redirect-page.html

/redirect-page.html

/css/styles.css

/css/styles.css

/cgi-bin/FormMail.pl

/cgi-bin/FormMail.pl

My index page includes the form with a redirect input:

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

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

When I wrote redirect.html I copied and pasted the head from the index page. It contained the link to styles.css as follows:

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

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

The form submission worked properly and I was redirected to redirect.html, however redirect.html was not linking to css/styles.css.

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

I realized that redirect.html was being loaded from the FormMail.pl file in /cgi-bin, and the link reference was looking for styles.css in that same folder.

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

So I edited the header of redirect.html to correct the path to my style.css as follows to indicate going out of /cgi-bin and back into /css:

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

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

After that, redirect.html was linking to styles.css.

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

#1


1  

Check your layout file or like this which includes the css file.

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

#2


0  

I embedded a form on my website with FormMail script.

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

In the root folder of my server I have the following structure:

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

/index.html

/index.html

/redirect-page.html

/redirect-page.html

/css/styles.css

/css/styles.css

/cgi-bin/FormMail.pl

/cgi-bin/FormMail.pl

My index page includes the form with a redirect input:

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

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

When I wrote redirect.html I copied and pasted the head from the index page. It contained the link to styles.css as follows:

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

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

The form submission worked properly and I was redirected to redirect.html, however redirect.html was not linking to css/styles.css.

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

I realized that redirect.html was being loaded from the FormMail.pl file in /cgi-bin, and the link reference was looking for styles.css in that same folder.

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

So I edited the header of redirect.html to correct the path to my style.css as follows to indicate going out of /cgi-bin and back into /css:

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

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

After that, redirect.html was linking to styles.css.

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