[英]How to store span id value in to PHP variable
我想知道如何將 span/div id 值存儲到 PHP 變量中……在 id=event_id 中有像“234”這樣的值……所以我想將該值存儲到 php 變量中
<?php
//This Statement stores data in variable
$test = '<span id ="event_id" ></span>';
//this is for printing variable that contains data
echo $test;
?>
<script>
function setEventId(event_id){
document.querySelector('#event_id')= event_id;
}
</script>
如果我正確理解了你的問題,你想做這樣的事情:
<?php
//This Statement stores data in variable
$test = '<span id ="event_id" ></span>';
//this is for printing variable that contains data
echo $test;
$event_id = "<script>document.writeln(document.getElementById('event_id').innerHTML)</script>";
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.