dongrouli2667 2014-12-28 19:45
浏览 269

如何在页面上的标签中输出字符串?

I am trying want to ouput a string ,stored in a variabel, in a label on a page when i click on a button. But i can't find out how. Still a beginner.

<form action="Test.php" method="post">
Output text: <input type="label" name="word" />
<input type="submit" method="submit" value="Print!" />
</form>
<?php
$word = "test";
if (isset($_POST['submit']))
{
//something that gives the label value $word//
}
?>
  • 写回答

3条回答 默认 最新

  • donglou8371 2014-12-28 19:47
    关注

    Your code should look like this

    <form action="Test.php" method="post">
    Output text: <input type="label" name="word" value ="<?php echo isset($label['data'])?$label['data']: '' ?>" />
    <input type="submit" method="submit" value="Print!" />
    </form>
    <?php
    $word = "test";
    $label = array();
    if (isset($_POST['submit']))
    {
    //something that gives the label value $word//
       $label['data'] = $word;
    }
    ?>
    

    This should work

    Regards Ahmad rabbani

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog