Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php的下一行中打印文本内容和变量_Php - Fatal编程技术网

如何在php的下一行中打印文本内容和变量

如何在php的下一行中打印文本内容和变量,php,Php,我想在下一行打印文本内容和变量,在我的代码中,使用sql查询检索数据,并使用echo语句显示。我的代码如下 echo '<input type="hidden" id="imgdesc" value="Disease_name:'.$result->Disease_name.',Patient_age:'.$result->Patient_age.',Patient_sex:'.$result->Patient_sex.',Disease_duration:'.$res

我想在下一行打印文本内容和变量,在我的代码中,使用sql查询检索数据,并使用echo语句显示。我的代码如下

echo '<input type="hidden" id="imgdesc"  value="Disease_name:'.$result->Disease_name.',Patient_age:'.$result->Patient_age.',Patient_sex:'.$result->Patient_sex.',Disease_duration:'.$result->Disease_duration.',Family_history:'.$result->Family_history.',Affected_bodyPart:'.$result->Affected_bodyPart.',Medical_historys:'.$result->Medical_history.'" /></td>';
echo';
对于上面的查询,我得到如下输出

echo '<input type="hidden" id="imgdesc"  value="Disease_name:'.$result->Disease_name.',Patient_age:'.$result->Patient_age.',Patient_sex:'.$result->Patient_sex.',Disease_duration:'.$result->Disease_duration.',Family_history:'.$result->Family_history.',Affected_bodyPart:'.$result->Affected_bodyPart.',Medical_historys:'.$result->Medical_history.'" /></td>';
疾病名称:ACPToParthenium,患者年龄:70岁,患者性别:男性,病程:6个月,家族史:无类似病例,受累部位:腿部,病史:患者无其他疾病

但是我想要以下格式的输出

  • 疾病名称:阿普托帕坦
  • 病人年龄:70
  • 病人(u)性别:男
  • 病程:6个月
  • 家族史:无类似病例
  • 受影响的身体部位:腿部,医学史
  • 病史:患者无其他疾病

  • 有什么方法可以使用“br”标记或任何其他方法实现吗?

    要实现这一点,您需要使用文本区域,而不是文本输入字段

    <textarea name="your_input_field" cols="30" rows="7"></textarea>
    
    
    
    “cols”字段是textarea的宽度,“rows”是textarea中的行数(如表中的行)

    另外,我不知道你为什么要这么做,因为你上面的代码是一个隐藏字段

    从您下面的评论中,我认为这可能符合您的需要(我将值保留为空,但显然这些值需要包含您希望传递的值):

    
    
    然后在第二页上,您可以通过使用textarea表轻松地以您想要的格式显示这些内容(我不确定您使用的是GET还是POST,所以我只使用GET):


    您可以在不同的标签中显示值,也可以在单独的标签中显示值

    <td><?php echo "Disease_name:".$result->Disease_name; ?></td>
    <td><?php echo "Patient_age:".$result->Patient_age; ?></td>
    
    
    

    等等

    如果您想在队列中回音,请尝试以下操作:

      echo '<textarea name="someting" cols="30" rows="7">';
        echo 'Disease_name: ' . $result->Disease_name . '<br/>';
        echo 'Patient_age: ' . $result->Patient_age . '<br/>';
        echo 'Patient_sex: ' . $result->Patient_sex . '<br/>';
        echo 'Disease_duration' . $result->Disease_duration . '<br/>';
        echo 'Family_history: ' . $result->Family_history . '<br/>';
        echo 'Affected_bodyPart: ' . $result->Affected_bodyPart . '<br/>';
        echo 'Medical_historys: ' . $result->Medical_historys;
       echo '</textarea>';
    
    echo';
    回声“疾病名称:”$结果->疾病名称
    ; 回显“患者年龄:”$结果->患者年龄。”
    ; 回应“患者性别:”$结果->患者性别。”
    ; 回声“疾病持续时间”$结果->疾病持续时间。”
    ; 回音“家族史:”$结果->家族史。”
    ; 回显“受影响的身体部位:”$结果->受影响的身体部位。”
    ; echo“医学史:”$结果->医学史; 回声';
    你能给出php代码吗?$result=$mysqli->query(“选择疾病名称、路径、疾病ID、患者年龄、患者性别、疾病持续时间、家族史、受影响的身体部位、疾病信息中的病史,其中ID>=$current\u图片和疾病名称\u ID=$dropdown\u val LIMIT 1”)->获取对象();请在你的问题中包括这一点。我使用文本区域来显示这些内容,但它是单行的。你发布的代码不是文本区域。这是一个包含文本的输入字段,这是有区别的。我正在将这些变量传递到另一个页面,这就是我使用id=imgdesc的原因。您可以将该id与文本区域一起使用,并且信息仍将传递到下一个页面。你试过用textarea替换零件吗?我得到了所有的值,我的问题是它应该在textarea中以不同的行出现Hi nutty程序员,我试过这种方法,但第二个值没有显示,我将这些值传递到其他页面,并使用jquery将其显示在文本区域中。您可以尝试使用多个隐藏字段分别获取值,并使用jquery添加样式。
      echo '<textarea name="someting" cols="30" rows="7">';
        echo 'Disease_name: ' . $result->Disease_name . '<br/>';
        echo 'Patient_age: ' . $result->Patient_age . '<br/>';
        echo 'Patient_sex: ' . $result->Patient_sex . '<br/>';
        echo 'Disease_duration' . $result->Disease_duration . '<br/>';
        echo 'Family_history: ' . $result->Family_history . '<br/>';
        echo 'Affected_bodyPart: ' . $result->Affected_bodyPart . '<br/>';
        echo 'Medical_historys: ' . $result->Medical_historys;
       echo '</textarea>';