2013-09-14 00:32
浏览 25

如何将数据从mysql数据库显示到php中的标签? [关闭]

I want to get form labels that are stored in Mysql so i can easily display any language using select statement.
this is what i did but its hard to implement since i have different languages.
any guidance will be appreciated.


图片转代码服务由CSDN问答提供 功能建议

我想获得存储在Mysql中的表单标签,这样我就可以使用select语句轻松显示任何语言。 > 这就是我所做的,但由于我有不同的语言,因此很难实现。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dtpfia3334 2013-09-14 02:51

    It's better to store labels in php document, than in your html document call it with echo based upon language selection.

    PHP - filename e.g. lang-en.php

      // Language English
      $name   = 'Name';
      $phone  = 'Phone';
      $street = 'Street';
      // and so on...

    HTML - must be with .php extension! e.g. index.php

    <!doctype html>
    include('lang-en.php'); <!-- Include default language -->
      <!-- Process select with jQuery/AJAX to include file in your index.php based upon selection -->
      <form id="select-lang">
        <select id="language">
          <option value="en">English</option>
          <option value="de">Deutsch</option>
          <option value="es">Espanol</option>
        <label for="name"><?php echo $name; ?></label>
        <input name="name" type="text" id="name"/>
    解决 无用
    打赏 举报

相关推荐 更多相似问题