【问题标题】:mpdf showing a radio button and checkbox selectedmpdf 显示选中的单选按钮和复选框
【发布时间】:2021-08-28 12:11:40
【问题描述】:

我有一个小问题。

当用户单击按钮时,我会创建一个 pdf 输出。但是我遇到的问题是收音机和复选框。我尝试使用标准
($answer == '价值是什么') ? '检查':''

但是,当它输出为 pdf 时,它不会显示选中的单选按钮或复选框。有没有办法可以在 pdf 输出中选择单选按钮或复选框?

谢谢

【问题讨论】:

    标签: php pdf checkbox mpdf


    【解决方案1】:

    好的,我找到了解决方案。我所做的是将复选框和单选按钮放在 if 语句中,并且我确实将代码按以下格式放置:

    <input type="radio" checked="checked"> Yes
    

    成功了..

    【讨论】:

    • 不行,应该是 ,谢谢。
    • 谢谢。你节省了我的时间。同理 Selected 属性应该是&lt;select name="city"&gt;&lt;option value="HYD" selected="selected"&gt;Display&lt;/option&gt;&lt;/selected&gt;
    【解决方案2】:

    试试这个:

    if ($answer = "1"){
    
     $output .= 'Yes <input type="checkbox" checked /> ';
    }
    else{
     $output .= 'Yes <input type="checkbox" /> ';
    }
    

    1 为真。我假设,您从 db.xml 获得这些值。如果选中,则在此循环中检查这些值。

    【讨论】:

    • 是的,它来自数据库。我会试一试..谢谢。
    【解决方案3】:
    <input type="radio" value="1" <?php $data->input_11 == 1 ? 'checked="checked"' : null ?> > Yes
    
    <input type="checkbox" value="1" <?php $data->input_11 == 1 ? 'checked="checked"' : null ?> > Yes
    

    它适合我

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-07
      • 1970-01-01
      • 1970-01-01
      • 2017-10-22
      • 2018-02-24
      • 1970-01-01
      • 2011-10-18
      相关资源
      最近更新 更多