纬度问题的格式文本框

时间:2014-06-17 18:29:38

标签: php html mysql format

我在MySQL数据库中定义字段并将其显示在PHP表单的文本框中时遇到问题。

关于书面格式的纬度和经度。

我在数据库中有字段,纬度存储一个值,例如:52°18'29“N 该领域的结构是 类型:varchar(50) 整理:utf8_unicode_ci

我也尝试过输入:text

文本框的html是:

 <input type="text" name="latitude" size="40" 
 value="<? echo "$row[latitude]"?>">

当我调用表单时,数据如下所示: 52°18? 29? Ñ

我如何更改它以便将其格式化为:52°18'29“N

我应该在数据库中以不同方式存储它吗?

1 个答案:

答案 0 :(得分:0)

如果您只是想让bandaid解决问题,可以这样做:

<input type="text" name="latitude" size="40" 
 value="<? echo "str_replace('?','\'',$row[latitude]"?>">

http://sandbox.onlinephpfunctions.com/code/f0aaab9d9141b6294e0b92cc976044c9d4726cdb

相关问题