About Me

My photo

I am Ram, a Web Designer and Developer.   More than 4  years of experience in software development. Created complex back-end management systems including content management, e-commerce, customer relations and communication interfaces. The projects based on PHP in conjunction. PHP, SQL, JavaScript, AJAX, XHTML, CSS (Responsive), I help people make beautiful websites, functional applications and seamless user experiences.

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>

jquery_popup.html


Given below our complete HTML code to create Login and Contact form.


<html>
<head>
<title>jQuery Popup Login and Contact Form</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link rel="stylesheet" href="css/jquery_popup.css" />
<script src="jquery_popup.js"></script>
</head>
<body>
<div id="mainform">
<h2>jQuery Popup Form Example</h2>
<!-- Required Div Starts Here -->
<div class="form" id="popup">
<b>1.Onload Popup Login Form</b><br/><hr/>
<span>Wait for 3 second.Login Popup form Will appears.</span><br/><br/><br/>
<b>2.Onclick Popup Contact Form</b><hr/>
<p id="onclick">Popup</p>
</div>
</div>
<!-- Contact Form -->
<div id="contactdiv">
<form class="form" action="#" id="contact">
<img src="button_cancel.png" class="img" id="cancel"/>
<h3>Contact Form</h3>
<label>Name: <span>*</span></label>
<input type="text" id="name" placeholder="Name"/>
<label>Email: <span>*</span></label>
<input type="text" id="email" placeholder="Email"/>
<label>Contact No: <span>*</span></label>
<input type="text" id="contactno" placeholder="10 digit Mobile no."/>
<label>Message:</label>
<textarea id="message" placeholder="Message......."></textarea>
<input type="button" id="send" value="Send"/>
<input type="button" id="cancel" value="Cancel"/>
<br/>
</form>
</div>
<!--Login Form -->
<div id="logindiv">
<form class="form" action="#" id="login">
<img src="button_cancel.png" class="img" id="cancel"/>
<h3>Login Form</h3>
<label>Username : </label>
<input type="text" id="username" placeholder="Ex -john123"/>
<label>password : </label>
<input type="text" id="password" placeholder="************"/>
<input type="button" id="loginbtn" value="Login"/>
<input type="button" id="cancel" value="Cancel"/>
</form>
</div>
</body>
</html>
 
 

JavaScript File – jquery_popup.js

  • Wait for 3 seconds and jQuery on load event of page allows Login form to popup on exact center of screen.
  • To popup Conact Formuser have to click on “Popup” button.