回应包含的问题

时间:2014-04-15 12:48:46

标签: javascript php jquery html

您好我一直在尝试解决目前我遇到的烦人问题,我有一个普通文本的PHP页面和一些显示来自数据库的信息的下拉框,我有一些按钮使用{{ 1}}和ul附加到下拉框我有几个JavaScript函数禁用第二个和第三个,直到选择前两个选项,这一切都有效。

我遇到的问题是我有一个PHP变量,其中包含页面的大部分HTML和文本,并且它已被回显但我想将下拉框放在此部分中但是我需要的下拉框有一个包含我的下拉框正常工作,但每次我尝试任何单词包括回显到屏幕或它显示我一个白页。这是我的变量

中的文字
li

以下这部分是我的下拉框的代码

$info = '<div id="Text">This page will guide you through how to create your own Careers in the Classroom presentation.
Producing a presentation is very simple, just follow the steps below: 
<ol>
1)  Choose an academic principle around which to base your answers
    <li>    This will determine in which lesson your presentation will be shown to pupils </li>
    <li>    First choose an academic subject from the drop-down box below (i.e. Maths, Science, Geography)</li>
    <li>    Then choose an area out of the subject you have chosen (i.e. Geometry, Physics, Physical Geography) </li>
    <li>    Which will then bring up a list of principles to choose from* (i.e. Area, Forces, Rocks)</li>
    *Make sure you pick the principle which is most relevant to your job because you will be asked to talk about it later*
</ol>


<<<<< this is where i want my drop down boxes to be >>>>

<br/><br/>
<ol>
    2)  Take note of your target age 
    <li>    Click the Show my target age button and take note</li>
    <li>    The principle you have chosen will be taken from a school curriculum which may apply to a variety of age ranges. Bear in mind that if you are preparing a presentation for a 16 year old pupil this will need to have a different tone to that aimed at an 8 year old pupil.</li>
    <div id="ResultList" >
        Click the button to find the key stage
    </div>
    <input style="position:relative;left:320px;top:-20px;" type="submit" value="Search"/>
</ol>
<ol>
    3)  Download the questionnaire 
    <li>    Below you will find a link to the questionnaire, it will be beneficial to read over this before you begin videoing. </li>
    <li>    The questionnaire is split into sections the most important section is D - Using school subjects in your career. </li>
    <li>    When answering the questions try to elaborate on your answers, the more information the better. </li>
    <li>    Where there is a choice of questions out of a section try to choose the ones which relate to your career the most or which yield surprising and interesting answers</li>
</ol>
<br/>
<ul style="width:140px;position:absolute;top:440px;height:25px;padding-top:1px;left:60px;list-style-type:none;" id="menu">
    <li style="list-style-type:none;">
        <a href=./downloads/questionaire.pdf>
            Questionnaire 
        </a>
    </li>
</ul>
<ol> 4) Filming your answers
    <li>    When you are ready you can film the answers to the questionnaire </li>
    <li>    The guide below will help you</li>
</ol>
<br/>
<br/>
<ul style="width:225px;height:25px;padding-top:1px;position:absolute;top:550px;left:60px;list-style-type:none;" id="menu">
    <li style="list-style-type:none;">
        <a href=./downloads/producingavideo.docx>
            Guide to Producing a Video
        </a>
    </li>
</ul>

<ol> 5)Upload your footage to this website
    <li>    You will find a link below which will take you to the upload page </li>
    <li>    Here you will need to input information about your career and about the academic principle you have chosen </li>
    <li>    You will also need to put all your footage into a zipped folder and upload it - see the instructions below</li>
</ol>
<ul style="width:105px;height:25px;padding-top:1px;position:absolute;top:690px;left:60px;list-style-type:none;" id="menu">
    <li style="list-style-type:none;">
        <a href=./downloads/producingavideo.docx>
            zip files 
        </a>
    </li>
</ul>
<br/>
    If you have any difficulty with any part of this website please do not hesitate to contact us using the details on the home page </div> ';

如果我将上面的代码放在没有include "select.class.php"; echo "<form id=\"select_Academic\">"; echo "<select style=\"width:200px;\" id=\"category\" name=\"cat\" >"; echo $opt->ShowAllCategory(); echo "</select>"; echo "<select style=\"width:200px;\"id=\"type\">"; echo "<option value=\"%\">"; echo "Section"; echo "</option>"; echo "</select>"; echo "<select style=\"width:200px;\"id=\"principle\">"; echo "<option value=\"%\">"; echo "Principle"; echo "</option>"; echo "</select>"; 的情况下,所有内容都正确显示,但下拉框不会按预期运行。

我查看了这个链接Include whole content of a file and echo it

任何想法都会非常感激

1 个答案:

答案 0 :(得分:0)

更改

<<<<< this is where i want my drop down boxes to be >>>>

[LIST1] [LIST2]

更改

echo "<form id=\"select_Academic\">";
echo "<select style=\"width:200px;\" id=\"category\" name=\"cat\" >";
echo $opt->ShowAllCategory();
echo "</select>";

要 $ list1 =&#34;&#34; 。           &#34;&#34; 。           $ opt-&gt; ShowAllCategory()。           &#34;&#34 ;;

然后执行str_replace(&#34; [LIST1]&#34;,$ list1,$ info);