douye9822 2017-03-01 15:46
浏览 5

禁用输入类型问题

when I disable my date-picker input type when i echo the variable that has the values it doesn't show the correct data , appears 1970-01-01 but when i delete the disable tag from the input It starts working fine can you explain me why and help me solving this problem?

<html>
    <div class="two-col">
        <div class="col1">
            <label class="label1" style="font-size:20px" for="name"> Data de Cria&ccedil&atildeo</label>
            <input onkeypress="javascript:return false;" type="text" name="pdatacri" id="pdatacri" class="IP_calendar" title="Y-m-d" placeholder="Ano-Mes-Dia" value="<?php echo $datacri; ?>" style="width:200px;"> 
        </div>
        <div class="col2">
            <label class="label1" style="font-size:20px" for="name"> Data de Publica&ccedil&atildeo</label>
            <input onkeypress="javascript:return false;" type="text" name="pdatapub" id="pdatapub" alt="Data de Publicacao" class="IP_calendar" title="Y-m-d" placeholder="Ano-Mes-Dia" style="width:200px;" value="<?php echo $datapub; ?>"> 
        </div>
    </div>
</html>

PHP file

<?php
$datacri = mysqli_real_escape_string($link, $_POST['pdatacri']);
$datacri = date('Y-m-d', strtotime(str_replace('-', '/', $datacri)));
$datapub = mysqli_real_escape_string($link, $_POST['pdatapub']);
$datapub = date('Y-m-d', strtotime(str_replace('-', '/', $datapub)));

echo $datacri;
echo $datapub;
<?

If you need more code ask for it. Thanks and have a nice day :)!

  • 写回答

1条回答 默认 最新

  • dongliang1893 2017-03-01 15:49
    关注

    Instead of disabling input, you should make it readonly

    <input type='text' id='datepicker' name='fromdate' value='2017-01-01' readonly>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化