Friday, 5 September 2014

Update query in php

<div id="contactdiv">

<?php
if(isset($_POST['update']))
{

 $user_mob = $_POST['mob_number'];
$emp_email = "liberoram@gmail.com";

echo $sql = "UPDATE user_register SET mobilenumber ='$user_mob'  where email= '$emp_email'";

$retval = mysql_query( $sql);

echo "Updated data successfully\n";

}
else
{
    echo "Updated data faild\n";
}

?>

<form class="form" action="#" method="post">       
<img src="<?php echo base_url()?>/images/button_cancel.png" class="img" id="cancel"/>
<div class="control-group">
<label for="mob_number" class="control-label">Enter your phone number</label>

<div class="controls">
<input type="text"  name="mob_number" id="mob_number" class="m-wrap medium"  required style="border-radius: 5px !important;  height: 34px !important;"/>

</div></div>
<input type="submit" class="btn theme-btn" name="update"   id="update" value="Update"/>
<input type="button"  class="btn theme-btn"  id="cancel" value="Cancel"/>
<br/>
</form>
</div>

No comments:

Post a Comment