通过onclick输入的PHP值

时间:2019-06-26 07:23:56

标签: php html

日历中有两个字段,输入的初始日期和当前日期,其中选择了日期。我只是不知道如何通过onclick选择后拉取值 我通过POST通过id或name尝试过,但仍然不能正常输入,使用POST方法就可以了

<form method="post">
   <h3>Click on the date entry field to call the calendar.:</h3> 
   <p>
      from the <input name="d1" type="text" 
            value="day month Year" 
            onfocus="this.select();_Calendar.lcs(this)" 
            onclick="event.cancelBubble=true;this.select();_Calendar.lcs(this)"  
            data-yearfrom="-80"
            data-yearto="5">yearto="5" />

      to the <input name="d2" type="text" 
            value="day month Year" 
            onfocus="this.select();_Calendar.lcs(this)" 
            onclick="event.cancelBubble=true;this.select();_Calendar.lcs(this)" 
            data-yearto="5">yearto="5" />

      <input  type="submit" name="select1"  form="myform" value="data from bd" />
  </p> 
</form>

1 个答案:

答案 0 :(得分:0)

修复了所有语法错误:

<form method="post" id="myform">
    <h3>Click on the date entry field to call the calendar.:</h3>
    <p>
        from the <input name="d1" id="d1" type="text"
                        value="day month Year"
                        onfocus="this.select();_Calendar.lcs(this)"
                        onclick="event.cancelBubble=true;this.select();_Calendar.lcs(this)"
                        data-yearfrom="-80"
                        data-yearto="5"/>

        to the <input name="d2" id="d2" type="text"
                      value="day month Year"
                      onfocus="this.select();_Calendar.lcs(this)"
                      onclick="event.cancelBubble=true;this.select();_Calendar.lcs(this)"
                      data-yearto="5"/>

        <input type="submit" name="select1" form="myform" value="data from bd"/>

    </p>
</form>