不能使用瑞典字符

时间:2015-09-01 15:05:39

标签: php html character

我不能在我的网站上使用我的瑞典字符。如果我使用ÅÄÖ。

,该网站只会显示错误消息“所有字段都需要填写”

如果我只输入oaa左右,它适用于所有领域,但如果我在其中一个字段中使用ÅÄÖ,我会收到错误,表示需要填写所有字段。

这对我来说是一个问题,因为我在网上有一个瑞典的无线电台,我的名单上的人希望用瑞典语向我发送请求。

任何人都可以帮助我,或者我该如何解决这个问题?

    <?php
    // Include the required glob.php file
    require_once( "../_inc/glob.php" );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

    <head>

        <title>radiPanel: Review Our DJ</title>

        <style type="text/css" media="screen">

            body {

                background: #ddeef6;
                padding: 0;
                margin: 0;

            }

            body, a, input, select, textarea {

                font-family: Verdana, Tahoma, Arial;
                font-size: 11px;
                color: #333;
                text-decoration: none;

            }

            a:hover {

                text-decoration: underline;

            }

            form {

                padding: 0;
                margin: 0;

            }

            .wrapper {

                background-color: #fcfcfc;
                width: 350px;
                margin: auto;
                padding: 5px;
                margin-top: 15px;

            }

            .title {

                padding: 5px;   
                margin-bottom: 5px;
                font-size: 14px;
                font-weight: bold;
                background-color: #eee;
                color: #444;

            }

            .content {

                padding: 5px;

            }

            .good, .bad {

                padding: 5px;   
                margin-bottom: 5px;

            }

            .good strong, .bad strong {

                font-size: 12px;
                font-weight: bold;

            }

            .good {

                background-color: #d9ffcf;
                border-color: #ade5a3;
                color: #1b801b;

            }

            .bad {

                background-color: #ffcfcf;
                border-color: #e5a3a3;
                color: #801b1b;

            }

            input, select, textarea {

                border: 1px #e0e0e0 solid;
                border-bottom-width: 2px;
                padding: 3px;

            }

            input {

                width: 170px;

            }

            input.button {

                width: auto;
                cursor: pointer;
                background: #eee;

            }

            select {

                width: 176px;

            }

            textarea {

                width: 288px;

            }

            label {

                display: block;
                padding: 3px;

            }

        </style>

    </head>

    <body>

        <div class="wrapper">

            <div class="title">

                Bedöm en DJ

            </div>

            <div class="content">
                <?php
                    // Check if the form has been submitted
                    if( $_POST['submit'] ) {

                        // The form has been submitted
                        try {

                            // Right, we have their data, so we check it and clean it up
                            $habbo   = $core->clean( $_POST['habbo'] );
                            $dj      = $core->clean( $_POST['dj'] );
                            $review = $core->clean( $_POST['review'] );
                            $ip      = $_SERVER['REMOTE_ADDR'];
                            $time    = time();

                            // Check for blank fields
                            if ( !$habbo or !is_numeric( $dj) or !$review ) {

                                // They have a problem
                                throw new Exception( "Alla fält är nödvändiga!" );
                            }
                            else {

                                // Everything is fine, so now to add our cleaned data to the database!
                                $db->query( "INSERT INTO reviews VALUES (NULL, '{$habbo}', '{$dj}', '{$review}', '{$ip}', '{$time}');" );

                                echo "<div class=\"good\">";
                                echo "<strong>Klart!</strong>";
                                echo "<br />";
                                echo "Din bedömning har nu skickats in, tack så mycket!";
                                echo "</div>";
                            }
                        }
                        catch( Exception $e ) {

                            echo "<div class=\"bad\">";
                            echo "<strong>Error</strong>";
                            echo "<br />";
                            echo $e->getMessage();
                            echo "</div>";

                        }
                    }
                ?>

                <p><strong>Känner du att du vill ge lite ris och ros till någon av våra DJ's?</strong> Använd formuläret nedanför och gör en bedömning på någon av våra DJ's!</p>

                <form action="" method="post">

                <label for="habbo">Ditt namn:</label>
                <input type="text" name="habbo" id="habbo" maxlength="255" />

                <br /><br />

                <label for="dj">DJ:</label>
                <select name="dj" id="dj">

                    <?php

                        $users = $db->query( "SELECT * FROM users" );

                        while( $array = $db->assoc( $users ) ) {

                    ?>

                    <option value="<?php echo $array['id']; ?>">
                        DJ <?php echo $array['username']; ?>
                    </option>


                    <?php

                        }

                    ?>

                </select>

                <br /><br />

                <label for="review">Meddelande:</label>
                <textarea name="review" id="review" rows="10"></textarea>

                <br /><br />

                <input class="button" type="submit" name="submit" value="Skicka" />

            </form>

            </div>

        </div>

    </body>
</html>

There you have some code..

2 个答案:

答案 0 :(得分:0)

尝试在<html>代码

之后添加此行
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">

检查文件编码并将其放在上一行

答案 1 :(得分:0)

您的文档类型已过时,您已将语言设置为英语。尝试使用以下doctype,html和meta标签启动HTML文件:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />