php - jQuery Mobile Form database update stopped working why -
i need help. have been developing form updates database. working fine using jquery mobile form , has stopped working. have stripped form down the bare minimum , still not working. when click on update information placed the browser shown below. update_db.php?niamh=1 database not updated. if click on refresh updates , displays success. if remove jquery header links works ok, jquery problem. sadly working ok couple of hours ago. code below, can 1 please help.
html form
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <form action="update_db.php" method="get"> <input type="checkbox" data-role="flipswitch" name="niamh" id="switch" value="1"> <input type="submit" data-inline="true" value="update"> </form> </body> </html>
php update_db.php
$host="localhost"; // host name $username="root"; // mysql username $password="14odiham"; // mysql password $db_name="heating"; // database name $tbl_name = "roomcontrol"; // connect server , select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select db"); $niamh = (isset($_get['niamh'])) ? 1 : 0; // insert data mysql $sql = "update $tbl_name set niamh=$niamh id=1"; $result = mysql_query($sql); // if insert data database, displays message "successful". if($result){ echo "successful"; echo "<br>"; } else { echo "error"; } ?> <?php //close connection mysql_close(); ?>
try:
<form action="update_db.php" method="get" data-ajax="false">
Comments
Post a Comment