我需要帮助在PHP中的单选按钮

时间:2016-01-22 22:21:24

标签: 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 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>

2 个答案:

答案 0 :(得分:1)

我不知道这或多或少是你要做的事情,但就像我说你可以用css这样做...这只是设置颜色,但你可以改变这样的所有属性

我猜不过,当用户点击public class Data { ... public void computeSomething() { swith(category){ case MMM : computeMMM();break; case MMO : computeMMO();break; ... } } private void computeMMM(){ ... } private void computeMMO(){ ... } } 时,您希望字体更改,但这不是您之前尝试的内容。

submit

答案 1 :(得分:0)

尝试:

<input type="text" <?php if (isset($_GET['font'])) echo "style='font-family: \"{$_GET['font']}\";'"; ?> name="message" required size="50" value="The Quick Brown Fox Jumps Over the Lazy Dog" autofocus>