Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我需要帮助在php单选按钮_Php - Fatal编程技术网

我需要帮助在php单选按钮

我需要帮助在php单选按钮,php,Php,我正在尝试这样做,当我在某个单选按钮上选择时,它将更改用户输入单词的文本框中的字体。如何使其在选择特定单选按钮时更改字体 <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the te

我正在尝试这样做,当我在某个单选按钮上选择时,它将更改用户输入单词的文本框中的字体。如何使其在选择特定单选按钮时更改字体

<!DOCTYPE html>
<!--
    To change this license header, choose License Headers in Project Properties.
    To change this template file, choose Tools | Templates
    and open the template in the editor.
    -->
<html>

<head>
  <title>Funky Font Message</title>
  <link href="font.css" rel="stylesheet" type="text/css"> </head>
<div id="pageContainer">
  <form>
    <h2>Please select a font and enter a message:</h2>
    <br>
    <input type="radio" name="font" value="ChunkRed"> Chunk Red
    <input type="radio" name="font" value="DecoBlue" checked> Deco Blue
    <input type="radio" name="font" value="Animals"> Animals
    <input type="radio" name="font" value="ElegantRed"> Elegant Red
    <input type="radio" name="font" value="Funky"> Funky
    <input type="radio" name="font" value="TapePunch"> TapePunch
    <br>
    <br>
    <input type="text" name="message" required size="50" value="The Quick Brown Fox Jumps Over the Lazy Dog" autofocus>
    <input type="submit" value="Send">
    <br>
    <br>
    <?php if (!empty($_GET[ 'message'])) { $message=$ _GET[ 'message']; for ($i=0 ; $i < strlen($message); ++$i) { $char=substr($message, $i, 1); if ($char !=" " ) { echo "<img src='/sandvig/Images/Alphabet/deco/blue/{$char}1.gif'>\n" ; } else { echo "<br />\n"; } } } ?> </form>
</div>

<body>

</html>

时髦的字体信息
请选择字体并输入消息:

大块红 德科蓝 动物 淡红 时髦的 打孔机



试试:


我不知道这是不是你想要做的,但就像我说的,你可以用css来做……这只是设置颜色,但你可以像这样改变所有的属性

不过,我想,看到您希望在用户点击
submit
时更改字体的评论后,您可能不会这么做

    <style>
        input[value="ChunkRed"]:checked ~ input[type="text"]{
            color:red!important;
        }
        input[value="DecoBlue"]:checked ~ input[type="text"]{
            color:blue!important;
        }
        input[value="Animals"]:checked ~ input[type="text"]{
            color:green!important;
        }
        input[value="ElegantRed"]:checked ~ input[type="text"]{
            color:purple!important;
        }
        input[value="Funky"]:checked ~ input[type="text"]{
            color:yellow!important;
            background:black;
        }
        input[value="TapePunch"]:checked ~ input[type="text"]{
            color:white!important;
            background:blue;
        }
    </style>

    <form>
        <h1>Stack - pure css</h1>
        <h2>Please select a font and enter a message:</h2><br>
        <input type="radio" name="font" value="ChunkRed"> Chunk Red
        <input type="radio" name="font" value="DecoBlue" checked> Deco Blue
        <input type="radio" name="font" value="Animals"> Animals
        <input type="radio" name="font" value="ElegantRed"> Elegant Red
        <input type="radio" name="font" value="Funky"> Funky
        <input type="radio" name="font" value="TapePunch"> TapePunch<br><br>

        <input type="text" name="message" required size="50" value="The Quick Brown Fox Jumps Over the Lazy Dog" autofocus>
        <input type="submit" value="Send">
    </form>

输入[value=“ChunkRed”]:选中~input[type=“text”]{
颜色:红色!重要;
}
输入[value=“DecoBlue”]:选中~input[type=“text”]{
颜色:蓝色!重要;
}
输入[value=“Animals”]:选中~input[type=“text”]{
颜色:绿色!重要;
}
输入[value=“ElegantRed”]:选中~input[type=“text”]{
颜色:紫色!重要;
}
输入[value=“Funky”]:选中~input[type=“text”]{
颜色:黄色!重要;
背景:黑色;
}
输入[value=“TapePunch”]:选中~input[type=“text”]{
颜色:白色!重要;
背景:蓝色;
}
堆栈-纯css
请选择字体并输入消息:
大块红 德科蓝 动物 淡红 时髦的 TapePunch


是的,javascript。jQuery使您希望的效果变得轻松。等等,您希望字体在用户输入消息时动态更改吗?或者您只是让用户声明要在后期处理中使用的字体?当用户单击所需的单选按钮,然后在文本框中键入内容时,您可以使用CSW。然后单击提交按钮。我希望在用户单击submit
$\u GET['message']
时更改字体,如果它是您的真实代码的一部分,则这是一个问题。另外,你应该养成接受答案的习惯,如果任何问题解决了你的其他问题。这也会告诉每个人已经找到了解决方案,不会让你的问题没有答案。你知道,这个网站是双向的。如果你希望得到帮助,你应该通过接受他们的回答来奖励那些帮助你的人。
    <style>
        input[value="ChunkRed"]:checked ~ input[type="text"]{
            color:red!important;
        }
        input[value="DecoBlue"]:checked ~ input[type="text"]{
            color:blue!important;
        }
        input[value="Animals"]:checked ~ input[type="text"]{
            color:green!important;
        }
        input[value="ElegantRed"]:checked ~ input[type="text"]{
            color:purple!important;
        }
        input[value="Funky"]:checked ~ input[type="text"]{
            color:yellow!important;
            background:black;
        }
        input[value="TapePunch"]:checked ~ input[type="text"]{
            color:white!important;
            background:blue;
        }
    </style>

    <form>
        <h1>Stack - pure css</h1>
        <h2>Please select a font and enter a message:</h2><br>
        <input type="radio" name="font" value="ChunkRed"> Chunk Red
        <input type="radio" name="font" value="DecoBlue" checked> Deco Blue
        <input type="radio" name="font" value="Animals"> Animals
        <input type="radio" name="font" value="ElegantRed"> Elegant Red
        <input type="radio" name="font" value="Funky"> Funky
        <input type="radio" name="font" value="TapePunch"> TapePunch<br><br>

        <input type="text" name="message" required size="50" value="The Quick Brown Fox Jumps Over the Lazy Dog" autofocus>
        <input type="submit" value="Send">
    </form>