dpl3350 2019-04-18 18:07
浏览 50
已采纳

错误回显形式预期逗号或分号

I am trying to echo a form which contains more php. I am getting error message expecting comma or semicolon.

Can anyone help me out?

echo "<html><body><form action="index.php?tagid="'.$tagid.'" method="post">edit scanned tag's value<input type="text" name="tagvalue"><br><input type="submit" value="<?php $file = fopen("myfile.json","a"); $tagval = json_decode($json); echo $tagval->{'tagid'}; fclose($file); ?>"></form></body></html>";

  • 写回答

1条回答 默认 最新

  • doushenyi9104 2019-04-18 18:08
    关注

    Your echo contains unescaped qoutes inside. Try this

    $file = fopen("myfile.json","a"); 
    $tagval = json_decode($json); 
    fclose($file); 
    echo '<html><body><form action="index.php?tagid="'.$tagid.'" method="post">edit scanned tag\'s value<input type="text" name="tagvalue"><br><input type="submit" value="'.$tagval->{'tagid'}.'"></form></body></html>';
    

    Or you could write as the following

    <?php
    $file = fopen("myfile.json","a"); 
    $tagval = json_decode($json); 
    fclose($file); 
    ?>
    <html>
        <body>
          <form action="index.php?tagid="<?php echo $tagid; ?>" method="post">edit scanned tag's value
            <input type="text" name="tagvalue"><br>
            <input type="submit" value="<?php echo $tagval->{'tagid'};?>">
          </form>
        </body>
    </html>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C# datagridview 栏位进度
  • ¥15 vue3页面el-table页面数据过多
  • ¥100 vue3中融入gRPC-web
  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改