php a data do tipo de entrada baseada na função onclick
O usuário escolhe a data, mês e ano e, em seguida, pressiona um botão para mostrar a ele o valor do banco de dados com base no dia em que ele escolheu. Não sei onde está o problema no código.
<style>
.button {border-radius: 8px;}
.button1 {font-size: 20px;}
</style>
<form>
إختر التاريخ : <input type="date" name="bday" id="dat"><br>
<button type=button class="button button1" onclick="document.getElementById('data').innerHTML = myFunction(document.getElementById('dat').value)">إظهار الإستهلاك اليومي</button>
<hr>
<span id="data" ></span>
</form>
<script>// <![CDATA[
function myFunction($x) {
$current_user=get_current_user_id();// to fetch the right data for the right user
// ياخذ اليوم والشهر والسنه الي اختارها اليوزر
global $wpdb;
$d=date('j');//define variable to store the day
$m=date('m');//define variable to store the month
$y=date('Y');//define variable to store the year
$daily_amount= $wpdb->get_var("SELECT daily_amount FROM arduino_period_use where ID=$current_user and day=d and month=$m and year=$y ");
//print_r($daily_amount);
}
// ]]></script