php das auf der Onclick-Funktion basierende Eingabetypdatum

Der Benutzer wählt Datum, Monat und Jahr und drückt dann eine Taste, um den Wert der Datenbank basierend auf dem Tag anzuzeigen, an dem er sich entschieden hat. Ich weiß nicht, wo das Problem im Code liegt.

<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

Antworten auf die Frage(4)

Ihre Antwort auf die Frage