[英]PHP font-size from HTML Form
I have a little problem. 我有一点问题。 I'd like to change the text size of a link by using variable from form. 我想通过使用表单中的变量来更改链接的文本大小。 I have tried using this simple process but it doesn't do anything. 我尝试使用此简单过程,但是它什么也没做。
Form part 形式部分
<label name="size">Text size:</label>
<input type="text" name="size">
if(isset($_POST['size'])) {
$size = $_POST["size"];
}
if(isset($url)) {
if(isset($_POST["okno"])) {
echo "<a href='$url' title='$titul' target=_blank style='color:'$barva' font-size:'$size'>$zobrazeni</a>";
} else {
echo "<a href= '$url' title='$titul' style='color:$barva' font-size:'$size'>$zobrazeni</a>";
}
}
Replace your code with the following 将代码替换为以下内容
if(isset($url)) {
if(isset($_POST["okno"])) {
echo "<a href='$url' title='$titul' target='_blank' style='color:$barva;font-size:$size;'>$zobrazeni</a>";
} else {
echo "<a href= '$url' title='$titul' style='color:$barva;font-size:$size;'>$zobrazeni</a>";
}
}
Drop the single quotes ( '
) around the style properties color
and font-size
. 在样式属性color
和font-size
周围加上单引号( '
)。 Those are causing a parsing error in your HTML. 这些在您的HTML中引起解析错误。 Also, you must have a semicolon ( ;
) between the two: 另外,您必须在两者之间使用分号( ;
):
if(isset($_POST['size'])) {
$size = $_POST["size"];
}
if(isset($url)) {
if(isset($_POST["okno"])) {
echo "<a href='$url' title='$titul' target=_blank style='color:$barva; font-size:$size>$zobrazeni</a>";
} else {
echo "<a href= '$url' title='$titul' style='color:$barva; font-size:$size>$zobrazeni</a>";
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.