Pages

Friday, January 16, 2015

PhoneGap Tutorial posting form data to MySql database Using PHP

Hi friends i am going to explain how to post mobile form data to MySql Database using PHP : Title : PhoneGap Tutorial - posting form data to MySql database Using PHP. Here is the html form source code , Requirements : PHP Server(you can install it in your local server or other wise you can use many free php webhosting servers online , I am using neq3.com for free control panel) Html5 JavaScript Css Here are the source files Html and JavaScript Files : Index.html





Insert title here





Ajax Form
































Category:


Website:


CouponTitle :
CouponDescription :
CouponCode :
AffiliateLink :
AffiliateImage :






Here is the PHP Server file :

$username="u462945266_sree";
$password="9963447141";
$database="u462945266_db";
$url = "mysql.neq3.com";

$category = $_POST[Category];
$website = $_POST[Website];
$title = $_POST[CouponTitle];
$description = $_POST[CouponDescription];
$code = $_POST[CouponCode];
$affiliatelink = $_POST[AffiliateLink];
$affiliateimage = $_POST[AffiliateImage];


mysql_connect($url,$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO Coupons(Category,Website,CouponTitle,CouponDescription,CouponCode,AffiliateLink,AffiliateImage) VALUES ($category,$website,$title,$description,$code, $affiliatelink, $affiliateimage)";

mysql_query($query);

mysql_close();
echo "You successfully added your Coupon";
?>
All Form data will be stored in mysql database like this In my next tutorial i am going to explain how to convert this table data xml service or xml sothat it can be used as webservice.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.