www.webdeveloper.com
Results 1 to 5 of 5

Thread: Output of contact.php for spanish speaking people?

  1. #1
    Join Date
    Feb 2012
    Posts
    264

    Output of contact.php for spanish speaking people?

    What do I've to translate of my contact.php for spanish speaking people (www.eduardlid.net)? (I' ve tried to make a start!)

    <?php
    /* Set e-mail recipient */
    $myemail = "eduard.lid@gmail.com";

    /* Check all form inputs using check_input function */
    $yourname = check_input($_POST['Su nombre y apellido'], "Ingresa su nombre y apellido por favor");
    $email = check_input($_POST['email']);
    $website = check_input($_POST['website']);
    $comments = check_input($_POST['comments'], "Write your comments");

    /* If e-mail is not valid show error message */
    if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+gresa)/", $email))
    {
    show_error("E-mail address not valid");
    }

    /* If URL is not valid set $website to empty */
    if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website))
    {
    $website = '';
    }

    /* Let's prepare the message for the e-mail */
    $message = "Hello!

    Your contact form has been submitted by:

    Name: $yourname
    E-mail: $email
    URL: $website

    Like the website? $likeit
    How did he/she find it? $how_find

    Comments:
    $comments

    End of message
    ";

    /* Send the message using mail() function */
    mail($myemail, $subject, $message);

    /* Redirect visitor to the thank you page */
    header('Location: gracias.htm');
    exit();

    /* Functions we used */
    function check_input($data, $problem='')
    {
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    if ($problem && strlen($data) == 0)
    {
    show_error($problem);
    }
    return $data;
    }

    function show_error($myError)
    {
    ?>
    <html>
    <body>

    <b>Please correct the following error:</b><br />
    <?php echo $myError; ?>

    </body>
    </html>
    <?php

  2. #2
    Join Date
    Oct 2012
    Location
    /dev/null
    Posts
    15
    do you just want to translate the english parts to spanish?

  3. #3
    Join Date
    Feb 2012
    Posts
    264

    Translate php contact form?

    No, to make it work. This is copied and paste! So, what do I have to translate and what not? (e. g. name=nombre)
    Last edited by asa; 10-08-2012 at 06:28 AM.

  4. #4
    Join Date
    Mar 2009
    Posts
    452
    replace the following sentences or terms with their translated ones

    Write your comments
    E-mail address not valid
    Hello!
    Your contact form has been submitted by:
    Name
    E-mail
    URL
    Like the website?
    How did he/she find it?
    Comments
    End of message
    Please correct the following error

  5. #5
    Join Date
    Feb 2012
    Posts
    264
    Thanks very much!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles