cannot save form data into db when I click submit button : <p>I have a php code, I want to save the form data into datatase. I test, I can write "insert into table values()" directly in database, it can insert into database.</p>

<p>But in my UI, when I click submit button, I cannot save into db?</p>

<pre><code>&lt;?php
    include('connectWorkbench.php');
    $sql=mysql_query("SELECT * FROM Properties");
    $epr = '';
    $msg = '';
    if(isset($_GET['epr']))
        $epr=$_GET['epr'];
    //++++++++++++++++++++++++++++++save record++++++++++++++++++
    if($epr=='save')
    {
        $pid=$_POST['pid'];
        $aid=$_POST['aid'];
        $uid=$_POST['uid'];
        $code=$_POST['code'];
        $name=$_POST['name'];
        $description=$_POST['description'];
        $parking=$_POST['parking'];
        $sfeet=$_POST['sfeet'];
        $price=$_POST['price'];
        $distance=$_POST['distance'];
        $owner=$_POST['owner'];

        $a_sql=mysql_query("INSERT INTO Properties VALUES($pid,$aid,$uid,$code,'$name','$description','$parking',$sfeet,'$price','$distance','$owner')");
        if($a_sql)
            header("location:index.php");
        else
        {
            $msg='Error:'.mysql_error();
            echo '$msg';
        }


    }

?&gt;
&lt;!--$query = mysql_query("SELECT * FROM Contact");
    while($row = mysql_fetch_array($query))
    {
        $id = $row['contact_ID'];
        $fname = $row['first_name'];
        $midname = $row['middle_name'];
        $lname = $row['last_name'];
        echo '&lt;br /&gt;' .$id. ':' . $fname . '&lt;br /&gt;';
    }
$query2 = mysql_query("SELECT * FROM Properties");
    while($row = mysql_fetch_array($query2))
    {
        $id = $row['property_ID'];
        $addressID = $row['property_address_ID'];
        $ownerID = $row['owner_user_ID'];
        $propertyCode = $row['property_type_code'];
        echo '&lt;br /&gt;' .$id. ':' . $addressID . ':' . $ownerID .':'. $propertyCode .'&lt;br /&gt;';
    }

    &lt;IMG SRC=""&gt;
    --&gt;
&lt;html&gt;
    &lt;head&gt;
    &lt;/head&gt;
    &lt;body&gt;

        &lt;h2 align="center"&gt;Contact Us&lt;/h2&gt;
        &lt;table align="center" border="1" cellspacing="0" cellpadding="0" width="700"&gt;
            &lt;thead&gt;
                &lt;th&gt;First Name&lt;/th&gt;
                &lt;th&gt;Middle Name&lt;/th&gt;
                &lt;th&gt;Last Name&lt;/th&gt;
                &lt;th&gt;Email Address&lt;/th&gt;  
                &lt;th&gt;Message&lt;/th&gt;
            &lt;/thead&gt;
        &lt;/table&gt;

        &lt;h2 align="center"&gt;Edit Property&lt;/h2&gt;
        &lt;form method="POST" action='index.php?epr=save'&gt;
            &lt;table align="center"  width="700"&gt;
                &lt;tr&gt;
                    &lt;td&gt;property id&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='pid'&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;Property address ID&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='aid'/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;Owner user ID&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='uid'/&gt;&lt;/td&gt;
                &lt;/tr&gt;

                &lt;tr&gt;
                    &lt;td&gt;Property type code&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='code'/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;Property name&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='name'/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;Property description&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='description'/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;Parking&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='parking'/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;Square feet&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='sfeet'/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;Rent price&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='price'/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;Distance from campus&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='distance'/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;Property owner&lt;/td&gt;
                    &lt;td&gt;&lt;input type='text' name='owner'/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;&lt;/td&gt;
                    &lt;td&gt;&lt;input type='submit' name='submitbutton' value="Submit"&gt;&lt;/td&gt;
                &lt;/tr&gt;

            &lt;/table&gt;

        &lt;/form&gt;
        &lt;!--+++++++++++++++++++++++++Show Data++++++++++++++++++++--&gt;

        &lt;h2 align="center"&gt;Property List&lt;/h2&gt;
        &lt;table align="center" border="1" cellspacing="0" cellpadding="0" width="1200"&gt;
            &lt;thead&gt;
                &lt;th&gt;Property ID&lt;/th&gt;
                &lt;th&gt;Property address ID&lt;/th&gt;
                &lt;th&gt;Owner user ID&lt;/th&gt;
                &lt;th&gt;Property type code&lt;/th&gt; 
                &lt;th&gt;Property name&lt;/th&gt;
                &lt;th&gt;Property description&lt;/th&gt;
                &lt;th&gt;Parking&lt;/th&gt;
                &lt;th&gt;Square feet&lt;/th&gt;
                &lt;th&gt;Rent price&lt;/th&gt;
                &lt;th&gt;Distance from campus&lt;/th&gt;
                &lt;th&gt;Property owner&lt;/th&gt;
                &lt;th&gt;Action&lt;/th&gt;
            &lt;/thead&gt;
            &lt;?php
            $i=1;
            while ($row=mysql_fetch_array($sql))
            {
                echo"&lt;tr&gt;
                    &lt;td&gt;".$i."&lt;/td&gt;
                    &lt;td&gt;".$row['property_address_ID']."&lt;/td&gt;
                    &lt;td&gt;".$row['owner_user_ID']."&lt;/td&gt;
                    &lt;td&gt;".$row['property_type_code']."&lt;/td&gt;
                    &lt;td&gt;".$row['property_name']."&lt;/td&gt;
                    &lt;td&gt;".$row['property_description']."&lt;/td&gt;
                    &lt;td&gt;".$row['parking']."&lt;/td&gt;
                    &lt;td&gt;".$row['square_feet']."&lt;/td&gt;
                    &lt;td&gt;".$row['rent_price']."&lt;/td&gt;
                    &lt;td&gt;".$row['distanceFromCampus']."&lt;/td&gt;
                    &lt;td&gt;".$row['property_owner']."&lt;/td&gt;
                    &lt;td align='center'&gt;
                        &lt;a href='#'&gt;Delete&lt;/a&gt; |
                        &lt;a href='#'&gt;Edit&lt;/a&gt;   |
                        &lt;a href='#'&gt;New&lt;/a&gt;
                    &lt;/td&gt;

                &lt;tr&gt;";
                $i++;
            }
            ?&gt;
        &lt;/table&gt;

    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
