Home

Friday, August 17, 2012

How to develop a website in Hindi Gujarati language

Step : 1 -> Create Database: `language`

Step : 2 -> Create Table
                  CREATE TABLE IF NOT EXISTS `lan` (
                          `id` int(11) NOT NULL AUTO_INCREMENT,
                          `hindi` mediumtext COLLATE utf8_bin NOT NULL,
                           PRIMARY KEY (`id`)
      ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;

Step : 3 -> Index.php
                 <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>How to develop a website in Hindi Gujarati language</title>    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

      // Load the Google Transliterate API
      google.load("elements", "1", {
            packages: "transliteration"
          });

      function onLoad() {
        var options = {
            sourceLanguage:
                google.elements.transliteration.LanguageCode.ENGLISH,
            destinationLanguage:
                [google.elements.transliteration.LanguageCode.HINDI],
               // if u want Gujarati Typing Please Replace HINDI With GUJARATI
            shortcutKey: 'ctrl+g',
            transliterationEnabled: true
        };

        // Create an instance on TransliterationControl with the required
        // options.
        var control =
            new google.elements.transliteration.TransliterationControl(options);

        // Enable transliteration in the textbox with id       
control.makeTransliteratable(['hindi']);
      }
      google.setOnLoadCallback(onLoad);
    </script>
</head>


<?php

mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("language") or die(mysql_error());

mysql_query('SET character_set_results=utf8');
mysql_query('SET names=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_connection=utf8');
mysql_query('SET character_set_results=utf8');

if($_SERVER['REQUEST_METHOD']=="POST")
{
$hindi = addslashes($_POST['hindi']);
$qry = "INSERT INTO lan (hindi) VALUES ('".$hindi."')";
mysql_query($qry) or die(mysql_error());
}

$sql = "SELECT * FROM lan";
$rs = mysql_query($sql) or die(mysql_error());

?>

<table width="100%" border="1">
<tr>    
        <td>Hindi Content</td>       
    </tr>
    <?php while($row = mysql_fetch_assoc($rs)){?>
    <tr>    
        <td><?php echo $row['hindi'];?></td>        
    </tr>
    <?php } ?>
</table>

<form method="post">
    Type in Hindi<br>    
    <!-- <textarea id="guj" name="guj" style="width:600px;height:200px"></textarea><br />-->
    <textarea id="hindi" name="hindi" style="width:600px;height:200px"></textarea><br />    
    <input type="submit" />
</form>

4 comments:

  1. Very Good Working..Thnx A Lot....

    ReplyDelete
  2. logic is very good display.
    i want to directly content display in gujarati and hindi language.
    please give me solution that.

    ReplyDelete
  3. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

    regards,
    Melbourne Web Designer

    ReplyDelete
  4. Ravishing article! I just discovered a good deal of noteworthy knowledge from this article and I am sure that this might benefit many seekers. Thank you for the share. Keep blogging.
    Website Design Agency | Website design company

    ReplyDelete

rathoddhirendra.blogspot.com-Google pagerank and Worth