PHP 部分在这里所以当我发布它时,else 部分根本不起作用(意思是:我设置的文本消失了),而另一半有效(意思是:我可以分配变量,但不能留空)。我整晚都在为此苦苦挣扎……请帮忙!所以这是第二页,如果你需要看第一页的代码,请告诉我!
<?php
$lovers = $_POST['lovers'];
$quote = $_POST['quote'];
$color = $_POST['color'];
$font = $_POST['font'];
$imdblink = $_POST['imdblink'];
?>
<?php
if (isset($_POST['lovers']))
{
$lovers = $_POST['lovers'];
}else{
echo "P & M";
}
if (isset($_POST['quote']))
{
$quote = $_POST['quote'];
}else{
echo "I love you.";
}
if (isset($_POST['color']))
{
$color = $_POST['color'];
}else{
echo "yellow";
}
if (isset($_POST['font']))
{
$font = $_POST['font'];
}else{
echo "Futura";
}
if (isset($_POST['imdblink']))
{
$imdblink = $_POST['imdblink'];
}else{
echo "http://www.imdb.com/";
}
?>
这是 HTML 部分:这里有什么问题吗?请帮忙!
<div class="artGroup slide">
<div class="artwork"> <img src="../_images/M&P.png">
<div class="detail">
<div class="movie01c" style="font-family: <?php echo "{$font}"; ?>; font-size: 20px; color: <?php echo "{$color}";?>;">
<?php echo "{$quote}";?>
</div>
<div class="movie01t"><a href="<?php echo "{$imdblink}";?>">
<?php echo "{$lovers}";?>
</a></div>
</div>
</div>
</div>