-2

I have one php page in which I have changed font for input to devnagri. I need to display it in next php page and also need to insert those to mysql.

first page index.php contains this details......

  <table width="535" height="54" border="1">
 <tbody>
<tr>
  <td height="23">नाम</td>
  <td><input type="text" name="name" id="name" style="font-family: Preeti"> 
  </td>
  </tr>
  <tr>
  <td height="23">काम</td>
  <td><input type="text" name="job" id="job" style="font-family: Preeti"> 
  </td>
</tr>
 </tbody>
</table>

index.php

my second page post.php contains

       <table width="535" height="54" border="1">
   <tbody>
     <tr>
       <td height="23">नाम</td>
     <td><?php
      echo $_POST['name'];
      ?></td>
     </tr>
     <tr>
      <td height="23">काम</td>
      <td><?php
   echo $_POST['job'];
   ?></td>
    </tr>
   </tbody>
 </table>

post.php

when I type कला in name and खेप in job input it displays relative english letters on the 2nd page ..... where as I need to display as it displays in input.

I also need to insert those input to mysql and again need to display those mysql data to another page....

I am not getting the way to display and stuck at this point so insert and select query is yet to be done....

Need help to figure it out.

  • 1
    The font used to display data has nothing to do with MySQL and is controlled by the HTML and CSS of the page displayed. The only bearing in MySQL might be the character set used in the table and columns. – Sloan Thrasher Mar 13 '18 at 06:10
  • As mentioned, you set the font using HTML and CSS, not in MySQL – Sloan Thrasher Mar 13 '18 at 06:14
  • Apply the same font to the element you display the value of the column in the 2nd page just like you did on the first page. Since you didn't include any of the PHP code, HTML and CSS, I can't offer more detail. – Sloan Thrasher Mar 13 '18 at 14:06
  • 1
    `$_post['name of inputs']` - This doesn't make any sense. Also - I don't see any inputs in your code, it should be `$_POST`, and this question should (probably) be tagged under CSS and HTML, not PHP or mysql. Please clarify your question and and only the **relevant** code – Alon Eitan Mar 13 '18 at 17:04
  • @user2570995 I do understand to question, but you didn't show us how you include the webfont (Did you try [adding this](https://webfonts.ffonts.net/index.php?p=css&id=26596) to your css?), also - Your table cells are all empty, so you woun't see the font because there is not actual text – Alon Eitan Mar 13 '18 at 18:37
  • 1
    You said you set the font in the first page on the input. Use the same method to set the font on the 2nd page. You show some code, but nothing related to your question. Show the code where you set the font to devnagri on the input field, and **only the code** you are using to display the same field on the 2nd page. – Sloan Thrasher Mar 13 '18 at 18:44
  • 1
    It would seem that you know how to set the font on an input field, so it would follow that you know how to set the code on the output in the 2nd page. What am I missing that you don't know/understand? – Sloan Thrasher Mar 13 '18 at 18:45
  • Required reading (and maybe even a duplicate) ~ https://stackoverflow.com/questions/279170/utf-8-all-the-way-through – Phil Mar 15 '18 at 04:41
  • How about ``? That's pretty much what @SloanThrasher's been saying all along though – Phil Mar 15 '18 at 04:44
  • Convert your `index.php` file to `UTF-8` (File Encoding). – Jaydeep Mor Mar 15 '18 at 04:47

1 Answers1

0

Thanx a lot Phil.

   <table width="535" height="54" border="1">
  <tbody>
   <tr>
  <td height="23">नाम</td>
  <td style="font-family: Preeti"><?php
   echo $_POST['name'];
   ?></td>
</tr>
<tr>
  <td height="23">काम</td>
  <td style="font-family: Preeti"><?php
   echo $_POST['job'];
   ?></td>
</tr>
  </tbody>
</table>

It has displayed preeti font...

Still INSERT and SELECT query is remaining.

  • The font isn't stored in MySQL. As mentioned in the comments above, it is used on the presentation side of things, not in storing the data. The font has no bearing on your insert or select queries. Character set might be a consideration, but that's in the definition of the table(s) you store the data in. – Sloan Thrasher Mar 15 '18 at 18:31
  • Thanx a lot Sloan Thrasher..... I have found solution .... I have to use style="font-family: Preeti" everytime i need to display result.... – user2570995 Mar 16 '18 at 14:27