Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7937501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:32:20+00:00 2026-06-03T22:32:20+00:00

Here is my contact function : public static function contact_anon() { $form = new

  • 0

Here is my contact function :

public static function contact_anon()
{
    $form = new Form('contact_anon');

    $form->field('email', 'text', array
    (
        'max_length'    =>  45,
        'valid_email'   =>  true
    ));

    $form->field('message', 'textarea', array
    (
        'max_length'    =>  400,
        'min_length'    =>  25
    ));

    if($data = $form->validate())
    {
        $envoi = array
        (
            'message'   =>  $data['message'],
            'email' =>  $data['email']
        );

        mail('mymail@gmail.com', lang('contact_anon'), lang('contact_anon_text', $envoi), 'From: noreply@'.$_SERVER['HTTP_HOST']);
    }

    return $form;
}

Then I have this other php file with the content text that will be sent + the message from the form :

<?php
fw::$lang = array_merge(fw::$lang, array
(   
'contact_anon_text'     =>  "You have been contacted :

    Message : {message}

    Mail : {email}"
));

The form is working well, but the {message} doesn’t display correctly, for example :

j\'écris avec des accents pour voir si ça marche.

The website has a UTF8 charset, but I don’t know about php, I tried the following :

'message'   =>  htmlentities((utf8_decode($data['message']), ENT_QUOTES),

But it returns :

syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting '(' 

I know there is hundreds of posts about UTF8, I checked them, read the php mnual and sql manual, but couldn’t understand so much as I am a beginner and not english speaker.

I also have the same problem when sending a text field to the database, eventhough the database is using utf8_general_ci. So I guess it’s definitely a problem with my php code. I am using a MVC scripts with controllers. To solve partially the SQL problem, I use :

return mysql_real_escape_string($string);
    ....
db::escape($username)

So the output is correct, but I had prefer to configure php to use UT8 and allows special characters like french accents.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:32:21+00:00Added an answer on June 3, 2026 at 10:32 pm

    Try saving your file with encoding UTF-8.
    If you are using visual studio go to File, Save As, Save With Encoding and choose Unicode(UTF-8 without signature).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my problem: I'm trying to set up a simple mobile contact form with
Here is the HTML: <%@ Page Language=C# AutoEventWireup=true CodeBehind=WebForm2.aspx.cs Inherits=DaVincisApp1.WebForm2 %> <!DOCTYPE html PUBLIC
I'm using ajax to send an email through a contact form in codeigniter. The
Here's my current set-up: Public Interface IDatabase Function CreateParameter(name as String, dbType as <dbTypeEnumeration>)
I have a simple class called Job with a public ctor and public function
I have this SaveCheckedStateToDB() function: public class oDaA_DBUtils { // TOOD: Perhaps this should
I use the following function to retrieve a contact's photo in Android where the
I've written a simple contact form in my mvc3 app. Everything seems to work
I'm attempting to use jQuery's $.ajax() function to post form variables to an MVC
I have a class called contact: class contacts { public $ID; public $Name; public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.