[請益] 也是網頁亂碼的問題

看板PHP作者 (豬肉腳)時間17年前 (2007/08/15 16:21), 編輯推噓2(201)
留言3則, 2人參與, 最新討論串1/3 (看更多)
請問版上各位高手 我在php檔中有寫 中文字 可是用網頁開就會碰到 中文變成亂碼的問題 出問題的程式碼部份如下 <tr> <td>問題如下</td> <td><input type="text" name="question" size="50"></td> </tr> 網址:http://140.123.175.240/DO/video_polls/addpoll_web.php 出現的問題就是裡面的 ????‧原本應該是"問題如下"四個字,英文部份沒問題 因為我有連結資料庫,那部份是沒有問題的 我也有加上這三行 mysql_query("SET NAMES 'utf8'"); mysql_query("SET CHARACTER_SET_CLIENT=utf8;"); mysql_query("SET CHARACTER_SET_RESULTS=utf8;"); 請問可以有告訴我該怎麼改嗎? 一直出現亂碼很困擾 感謝!! --------------------------------------------------- 另外附上完整程式碼‧如果有人願意看就太感動了 --------------------------------------------------- <html> <head> <title>Add User Poll</title> </head> <body> <font size="+2"><b>Add User Poll</b></font><br><br> <? // addpoll.php // If the form has been submitted... include('common.php'); // Connect to database $link = dbConnect(); mysql_query("SET NAMES 'utf-8'"); mysql_query("SET CHARACTER_SET_CLIENT=utf-8;"); mysql_query("SET CHARACTER_SET_RESULTS=utf-8;"); // Get date for new poll //$posted = time(); $posted = strftime("%A %d/%m/%y", $poll['posted']); print "&posted=" . urlencode($posted); // Build query to insert new poll $query = "INSERT INTO polls (question, option1, option2, option3, posted) VALUES('$question', '$option1', '$option2', '$option3', $posted)"; // Execute query $result = @mysql_query($query); // If query failed... if (!$result) { // Display error print "<font color=\"#ff0000\">Could not insert poll</font><br>\n"; } else { print "<font color=\"#0000ff\">Poll added</font><br>\n"; } mysql_close($link); ?> </form> </body> </html> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.123.175.240 ※ 編輯: divaka 來自: 140.123.175.240 (08/15 16:27) ※ 編輯: divaka 來自: 140.123.175.240 (08/15 16:28) ※ 編輯: divaka 來自: 140.123.175.240 (08/15 16:28)

08/15 16:28, , 1F
你是用什麼環境去寫code& http 的環境是?
08/15 16:28, 1F

08/15 16:31, , 2F
其實不太懂您的意思 不過我是用dreamweaver
08/15 16:31, 2F

08/15 16:31, , 3F
AppServ2.5.9
08/15 16:31, 3F
文章代碼(AID): #16mhTo01 (PHP)
文章代碼(AID): #16mhTo01 (PHP)