Hi Again,
I was wondering if somebody could help me see why I am getting this problem. I have written the program below but when I run it only certain fields will update with the values entered. All other fields will update but the address.
Thanks for the help: -
the html code is: -
<form action="user.php" method="post">
<table border="1">
<tr>
<td>Name</td>
<td><input type="text" name="FullName" /></td>
<td>Address</td>
<td><input type="text" name"address"/></td>
</tr>
<tr>
<td>Date of Joining</td>
<td><input type="text" name="Date"/></td>
<td>Telephone Number</td>
<td><input type="text" name="tele"/></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email"/></td>
<td>UserName</td>
<td><input type="text" name="User"/></td>
</tr>
<tr>
<td></td>
<td>Password</td>
<td><input type="text" name="pass" /></td>
</tr>
<tr>
<td colspan="4" style="text-align:center;"><input type="submit" value="Add Staff" /></td>
</tr>
</table>
</form>
my user.php program is: -
<?php
//connect to the database
$con = mysql_connect("servername","username","password");
if (!$con) //states that if connection can't be established run the error
{
die('Could not connect:'.mysql_error());
}
//link to the database Klinic_ganga_stock_system
mysql_select_db("Klinic_ganga_stock_system", $con);
//add the details from adminpage.html add new staff the the table staff_record
$sql = "INSERT INTO staff_record (Name,Address,Date_of_joining,Telphone_number,Email,UserName,Password)
VALUES
('$_POST[FullName]','$_POST[address]','$_POST[Date]','$_POST[tele]','$_POST[email]','$_POST[User]','$_POST[pass]')";
//run the query
if (!mysql_query($sql,$con)){//this states that if the query can not be run then it will print the error
die('Error:'.mysql_error());
}
else {
print"Information added";
}
//close the connection
mysql_close($con)
?>
thanks guys