dqwn64004 2019-04-06 22:27
浏览 62

我怎样才能从php中获取标签信息,以便在下拉列表的值发生变化时进行更改?

I have been looking at this code for probably 4 hours now trying to get it to do what I want. I want it so that when a new value is put in the dropdown menu the label below will update, but the information is coming from PHP though. How would I do this cause I have looked everywhere and I can't find something that would help. I think I saw somewhere that I can't do it like this with PHP since it is processed server side not client side, if that is true can you tell me what I am supposed to do?

<?php
echo "<script type='text/javascript'>
        function updatePrice()
        {
                var x = document.getElementById('partNumber').value;
                document.getElementById('price').innerHTML = 'HERE I AM ' + x;";
//              $pricesql = "SELECT partPrice FROM Parts WHERE partID = "document.getElementById('partNumber').value;;
                $priceresult = $pdo->query($pricesql);

echo "}
</script>";
?>
  • 写回答

1条回答 默认 最新

  • doushu7588 2019-04-07 05:42
    关注

    JavaScript allows you to update page contents dynamically without reloading the page, so if your application is static (no database) then you can use JavaScript, otherwise you have to use Ajax to send/receive data from the server using PHP as example.

    so you have to read about JavaScript and Ajax to solve the problem.

    best regards

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度