Page 1 of 1

how to update and insert the values using the javascript

Posted: Sat Jan 22, 2011 1:00 am
by kaif
how to update and insert the values using the javascript

when i want to click login the information should be insert into the database and when i want to click logout i want to update the login_status=1 in the database

here my code
<table>
<form name="form" action="test.php">
<tr>
<td bgcolor="#f9fafc" class="style1">Driver id</td>
<td bgcolor="#f9fafc"><label>
<input type="text" name="driver_id" />
</tr>
<tr>
<td bgcolor="#f9fafc" class="style1">Login - Status</td>
<td bgcolor="#f9fafc"><label>
<input type="radio" name="login_status" value="0" />Login
<input type="radio" name="login_status" value="1" />Logout

</tr>
<tr><td><input type="submit" ></td></tr></from>
this file is test.php file:
<?php
include("config.php");
if(isset($_POST['login_status']))
{
if($_POST['login_status']=='1')
$sql="UPDATE driver_login set login_status=1 where driver_id=$_POST['driver_id']";
}

my php code is not working Please help me

Re: how to update and insert the values using the javascript

Posted: Sat Jan 22, 2011 6:38 am
by thecodewall