定义PHP的不同方向

时间:2015-11-15 08:54:41

标签: html css

电话号码,电子邮件和日期字段应从左到右依次为姓名,家庭字段应从右到左。

<?php
echo '<input type="hidden" name="name" value="' . $amch["name"] . '">';
echo '<input type="hidden" name="family" value="' . $amch["family"] . '">';
echo '<input type="hidden" name="phone_number" value="' . $amch["phone_number"] . '">';
echo '<input type="hidden" name="email" value="' . $amch["email"] . '">';
$date= 1394-08-24
echo"$name", " " , "$family", " " , "$phone_number", "$email", "$date";
?>

1 个答案:

答案 0 :(得分:1)

为什么不使用css?
将您的代码更改为:

<style>
    .rtl { direction: rtl; text-align: right; }
    .ltr { direction: ltr; text-align: left; }
</style>
<?php
echo '<input type="hidden" class="rtl" name="name" value="' . $amch["name"] . '">';
echo '<input type="hidden" class="rtl" name="family" value="' . $amch["family"] . '">';
echo '<input type="hidden" class="ltr" name="phone_number" value="' . $amch["phone_number"] . '">';
echo '<input type="hidden" class="ltr" name="email" value="' . $amch["email"] . '">';
$date= 1394-08-24
echo"$name", " " , "$family", " " , "$phone_number", "$email", "$date";
?>