Hi, i want help regarding ODBC with ms access db with the help of PHP.?

  • Thread starter Thread starter AG
  • Start date Start date
A

AG

Guest
Hello, i am actually more surprised than being confused as i am not able to figure out where the things are going wrong for me. I am trying to insert the data from an html form into ms access database using php. The code is all fine and there is no error at all but then also the data is not getting inserted into the database. I am wondering why it is happening when everything is right. Please help me out. my code is:
HTML form:

<form name="form1" method="post" action="feedback.php" onSubmit="check();">
Name*<input type="text" name="name"/>
<br>
<br>
Email*<input type="text" name="email"/>
<br>
<br>
Website<input type="text" name="website"/>
<br>
<br>
Message*<textarea name="msg" rows="5" cols="25"></textarea>
<br>
<br>
<input type="submit" class="btn" value="Submit"/>

<input class="btn" type="reset" value="Reset"/>
</form>

PHP script:

<?php
$conn = odbc_connect('feedback','','');

$name = $_POST['name'];
$email = $_POST['email'];
$website = $_POST['website'];
$msg = $_POST['msg'];

if($conn)
{
$sql="INSERT INTO info (name, email, website, msg)
VALUES
('$name','$email','$website','$msg')";
}
odbc_close($conn);

echo "1 record added";

?>

My database name is "feedback" and the table name is "info".
 
Back
Top