How to insert Javascript variables into a database

前端 未结 1 367
清酒与你
清酒与你 2021-01-28 04:56

i would like to insert variables into my database, some are php wich works fine, but the problem is the javascript variables, it does not work. im quite new to this any help wou

相关标签:
1条回答
  • 2021-01-28 05:14

    ajax worked:

    if (radio2.checked == true)
    {
        var checked = 0;        
        xmlhttp = new XMLHttpRequest();
    
        xmlhttp.open("post","tc.php?ticketid='.$ticketnummer.'&ticketnummer='.$ticketno.'&hidden1=" + startdatum+"&hidden2=" + starttijd+"&hidden3=" + stopdatum+"&hidden4=" + stoptijd+"&hidden5=" + tekst+"&hidden6=" + stopdatumtijd + "&hidden7=" + checked, false);
        xmlhttp.send();
    }
    else if (radio3.checked == true)
    {
        var checked = 1;
        xmlhttp = new XMLHttpRequest();
    
        xmlhttp.open("post","tc.php?hidden8='.$current_user.'&ticketid='.$ticketnummer.'&ticketnummer='.$ticketno.'&hidden1=" + startdatum+"&hidden2=" + starttijd+"&hidden3=" + stopdatum+"&hidden4=" + stoptijd+"&hidden5=" + tekst+"&hidden6=" + stopdatumtijd + "&hidden7=" + checked , false);
        xmlhttp.send();
    }
    

    thank you for the advice.

    0 讨论(0)
提交回复
热议问题