回显include的问题

problems with echoing an include

本文关键字:问题 include 回显      更新时间:2023-09-26

嗨,我一直在努力解决目前遇到的一个烦人的问题,我有一个PHP页面,里面有普通文本和一些显示数据库信息的下拉框,还有一些使用ulli的按钮附在下拉框上。

我遇到的问题是,我有一个PHP变量,它包含了页面的大部分HTML和文本,并被回显,但我想把下拉框放在这个部分中,但有了下拉框,我需要有一个include才能使我的下拉框正常工作,但每次我尝试时,include都会被回显到屏幕上,或者它会显示一个白色页面。这是我的变量和中的文本

$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 "select.class.php";的情况下放入上面的代码,则所有内容都会正确显示,但下拉框没有按应有的方式运行函数。

我已经看了这个链接包括一个文件的全部内容并回显它

任何想法都将不胜感激

更改

<<<<< 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="。"。$opt->ShowAllCategory()。";

然后做一个str_replace("[LIST1]",$LIST1,$info);