How to save inputs of a user in a php form to mysql?

i have written my codes but the data is not getting stored. i cant figure out where is the mistake.. can u guys plz help me with my problem.. i need a solution real quick.. please help me figure out whats wrong with my below mentioned codes.. Here is what i have done.

echo $query="insert into distributor_records(Payment_Date,Distributor_Name,Mobile_No,Email,Payment,Address1,Address2)values('$a','$b','$c','$d','$e','$f','$g')";
echo "Record Successfully stored in DATABASE";
<body bgcolor="#CCCCCC">
<center><h1><u>Distributor Payments</u></h1></center>

<form method="post">
<table style=" border:1px solid silver" cellpadding="5px" cellspacing="0px"
align="center" border="0">
<td colspan="4" style="background:#0066FF; color:#FFFFFF; fontsize:
20px" align="center">ADD DISTRIBUTOR RECORD</td></tr>
<td><input type="date" name="p_date"/></td>
<td><input type="text" name="d_name" size="50"></td></tr>
<td>Mobile No:</td>
<td><input type="text" name="m_no" size="50"></td></tr>
<td>Email: </td>
<td><input type="text" name="email" size="50"></td></tr>
<td><input type="text" name="payment" size="50"></td></tr>
<td><input type="text" name="address1" size="50"></td></tr>
<td><input type="text" name="address2" size="50"></td></tr>
<td colspan="4" align="center">
<input type="submit" name="info" style="font-face: 'Comic Sans MS'; font-  size: larger; color: teal; background-color: #FFFFC0; border: 3pt ridge   lightgrey" value="Add Record"> |
<button type="reset" style="font-face: 'Comic Sans MS'; font-size: larger; color: teal; background-color: #FFFFC0; border: 3pt ridge lightgrey" value="Reset Form">Reset Form</button></td>

<p align="center"><a href="Distributor Payments.php">Go Back To Main Page</a></p>


Try this:

  $query="insert into distributor_records (Payment_Date,Distributor_Name,Mobile_No,Email,Payment,Address1,Address2)values('".$a."','".$b."','".$c."','".$d."','".$e."','".$f."','".$g."')";

mysql_query($query) or die(mysql_error());

if (mysql_query($query)) {

  echo "Record Successfully stored in DATABASE";

 }  else {
    echo mysql_error();

Hope this helps.

Peace! xD

Need Your Help

make element take up the space of a block, but render as inline


Here is an example of what I'm working with.

Get original filename when downloading with WebClient

c# .net webclient

Is there any way to know the original name of a file you download using the WebClient when the Uri doesn't contain the name?