php - form select with ajax -
i'm building bug tracker tool.
when create project, can change project status (open, in progress & finished) on project page using select form:
<form action="classes/projectstatus.class.php" method="post"> <label> change project status </label> <select name="status" id="status"> <option value="open">open</option> <option value="in progress">in progress</option> <option value="finished">finished</option> </select> <input type='hidden' name='hdnid' value="<?php echo $id;?>"> <input class="small button" value="change status" type="submit"> </form>
this projectstatus.class.php file:
$status = $_post['status']; $id = $_post['hdnid']; $sql="update projects set status = '$status'"; $result = mysql_query($sql); $result = mysql_real_escape_string($sql); if($result){ header('location: ../projectpage.php?id='.$id); } else { echo "there wrong. try again later."; } mysql_close();
how can ajax? provide me right code?!
i know form isn't sql injection proof , don't use mysqli, change this, first i'd have answer :).
thanks!
i use jquery, solve lot of compatibility issues.
there example code here on jquery site: http://api.jquery.com/jquery.post/
Comments
Post a Comment