如果有人可以查看此页面/屏幕截图并告诉我如何将其配置为仅显示Headers&当他们在该部分回答了问题时的小标题。
所有问题都已设置好并且只在他们回答时显示....但默认情况下,所有的标题和&小标题出现......这就是需要修复的东西。
如果每个部分只有1个问题,我可以解决它,但我在这里不知所措。
[编辑/补充:最后有一个“评论”部分,该标题(沿着w /用户评论)只会在他们添加评论时显示...默认情况下,“评论”标题是没有在结果页面上显示...只是不知道如何将几个问题与1个标题或小标题联系起来,每次重复出现!]
我的问卷有3个部分。每个部分大约有30个问题。这30个问题在不同的小节中分开。
例如,如果他们回答“历史”问题,我不希望任何事情出现在整个部分。 如果他们只回答“运动和游戏”中的两个问题,那么我只想要“历史”和“运动与游戏”来展示他们的两个问题。等等。
你如何处理这样的事情?
提前谢谢你, 崔西
<!-- HISTORY -->
<!-- ENVIRONMENT -->
<p class="data_hdr" style="margin-top:35px!important;">History</p>
<p class="data_subhd" style="margin-top:15px!important;">Environment</p>
<p class="data_answers">
<?php if (isset($_POST['typeofhouse'])) {echo '<strong>Type of House:
</strong> '; if ($name == $typeofhouse) echo ($_POST['typeofhouse']); if
($name == $othertypeofhouse) echo (' '); echo
htmlspecialchars($_POST['othertypeofhouse']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['sleeping-arrangement'])) {echo '<strong>Sleeping
Arrangement:</strong> '; echo htmlspecialchars($_POST['sleeping-
arrangement']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['pet-source'])) {echo '<strong>Pet Source:</strong>
'; echo htmlspecialchars($_POST['pet-source']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['age-acquired'])) {echo '<strong>Age Acquired:
</strong> '; echo htmlspecialchars($_POST['age-acquired']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['number-of-people'])) {echo '<strong>Number of
People:</strong> '; echo htmlspecialchars($_POST['number-of-people']);} ?>
</p>
<p class="data_answers">
<?php if (isset($_POST['neutered'])) {echo '<strong>Neutered:</strong> ';
echo htmlspecialchars($_POST['neutered']);} ?></p>
<!-- IF NEUTERED=YES -->
<p class="data_answers">
<?php if (isset($_POST['whywasyourpetneutered'])) {echo '<strong>Why was
your Pet Neutered:</strong> '; if ($name == $whywasyourpetneutered) echo
($_POST['whywasyourpetneutered']); if ($name == $otherwhywasyourpetneutered)
echo (' '); echo htmlspecialchars($_POST['otherwhywasyourpetneutered']);} ?>
</p>
<!-- WHY WAS YOUR PET NEUTERED=OTHER -->
<!-- IF NEUTERED-NO -->
<p class="data_answers">
<?php if (isset($_POST['are-you-interested-in-neutering'])) {echo
'<strong>Are you Interested in Neutering:</strong> '; echo
htmlspecialchars($_POST['are-you-interested-in-neutering']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['food-form'])) {echo '<strong>Food Form:</strong> ';
echo htmlspecialchars($_POST['food-form']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['foodbrand'])) {echo '<strong>Food Brand:</strong> ';
if ($name == $foodbrand) echo ($_POST['foodbrand']); if ($name ==
$otherfoodbrand) echo (' '); echo
htmlspecialchars($_POST['otherfoodbrand']);} ?></p>
<!-- FOOD BRAND=OTHER -->
<p class="data_answers">
<?php if (isset($_POST['who-feeds'])) {echo '<strong>Who Feeds:</strong> ';
echo htmlspecialchars($_POST['who-feeds']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['when-fed'])) {echo '<strong>When Fed:</strong> ';
echo htmlspecialchars($_POST['when-fed']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['treats'])) {echo '<strong>Treats:</strong> '; echo
htmlspecialchars($_POST['treats']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['table-food'])) {echo '<strong>Table Food:</strong>
'; echo htmlspecialchars($_POST['table-food']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['tablefoodreaction'])) {echo '<strong>Table Food
Reaction:</strong> '; if ($name == $tablefoodreaction) echo
($_POST['tablefoodreaction']); if ($name == $othertablefoodreaction) echo ('
'); echo htmlspecialchars($_POST['othertablefoodreaction']);} ?></p>
<!-- EXERCISE AND PLAY -->
<p class="data_subhd">Exercise and Play</p>
<p class="data_answers">
<?php if (isset($_POST['hours-outside'])) {echo '<strong>Hours Outside:
</strong> '; echo htmlspecialchars($_POST['hours-outside']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['restraint'])) {echo '<strong>Restraint:</strong> ';
echo htmlspecialchars($_POST['restraint']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['walks'])) {echo '<strong>Walks:</strong> '; echo
htmlspecialchars($_POST['walks']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['leash-type'])) {echo '<strong>Leash Type:</strong>
'; echo htmlspecialchars($_POST['leash-type']);} ?></p>
<p class="data_answers">
<?php if (isset($_POST['playtype'])) {echo '<strong>Play Type:</strong> ';
if ($name == $playtype) echo ($_POST['playtype']); if ($name ==
$otherplaytype) echo (' '); echo htmlspecialchars($_POST['otherplaytype']);}
?>
<!-- PLAY TYPE=OTHER -->
<p class="data_answers">
<?php if (isset($_POST['play-frequency'])) {echo '<strong>Play Frequency:
</strong> '; echo htmlspecialchars($_POST['play-frequency']);} ?></p>
不确定它是否有所作为......但这是表单的页面链接:http://www.safarivet.com/behavior-conditions/
答案 0 :(得分:0)
让它工作精美,如果有人遇到这篇文章并需要答案。
现在,无论用户回答1个子类别问题还是每个子类别问题,都会显示相关的子标题;否则,它不会。主要类别标题相同;如果任何子类别中的任何答案得到回答,它将显示;否则,默认情况下它将保持隐藏状态。
我的方法(当然,有一百万种方法可以做到这一点,就像这个领域中的任何东西一样;当然,我确信代码可以更短,更清洁等等......但是它有效!) :
<!-- HISTORY -->
<!-- ENVIRONMENT "HEADINGS" -->
<?php
if(isset($_POST['typeofhouse']))
{
echo '<p class="data_hdr" style="margin-top:35px!important;">History</p>
<p class="data_subhd" style="margin-top:15px!important;">Environment</p>';
}
else if(isset($_POST['sleeping-arrangement']))
{
echo '<p class="data_hdr" style="margin-top:35px!important;">History</p>
<p class="data_subhd" style="margin-top:15px!important;">Environment</p>';
}
else if.... THE REST FOR "ENVIRONMENT" SUB-CATEGORY
/* EXERCISE & PLAY "HISTORY" HEADING */
else if(isset($_POST['hours-outside']))
{
echo '<p class="data_hdr" style="margin-top:35px!important;">History</p>';
}
else if(isset($_POST['restraint']))
{
echo '<p class="data_hdr" style="margin-top:35px!important;">History</p>';
}
?>
/* SUB-HEAD FOR "EXERCISE & PLAY */
<!-- EXERCISE AND PLAY "HEADING" -->
<?php
if(isset($_POST['hours-outside']))
{
echo '<p class="data_subhd" style="margin-top:15px!important;">Exercise and
Play</p>';
}
else if(isset($_POST['restraint']))
{
echo '<p class="data_subhd" style="margin-top:15px!important;">Exercise and
Play</p>';
}
else if.... THE REST FOR "EXERCISE & PLAY" SUB-CATEGORY
?>
PHP答案部分与我之前粘贴的PHP保持一致,除了删除Headers&amp;分目(data_hdr&amp; data_subhd)&#34; P&#34;标签。表单的HTML链接(上面)现在仍然有效。完成后,它将从网站主菜单的某处链接。
崔西