update database from html form using ajax

后端 未结 3 517
隐瞒了意图╮
隐瞒了意图╮ 2021-01-20 06:24

I would like some help with ajax. I would like to update a php file which will update a database. I have a form which send the selected check box to a php file which then up

3条回答
  •  再見小時候
    2021-01-20 06:59

    I just want some suggestion and first your html page code should like-

    
    
        
    
    
    
    

    Now i am turning to php code: You used two line of code right in php

    $boiler = (isset($_GET['boiler'])) ? 1 : 0;
    $niamh = (isset($_GET['niamh'])) ? 1 : 0;
    

    $_GET is used in get method and $_POST for post method, thus you are using post method in ajax and above line of code should be like

    $boiler = (isset($_POST['boiler'])) ? 1 : 0;
    $niamh = (isset($_POST['niamh'])) ? 1 : 0;
    

提交回复
热议问题