Hi everyone, just as I thought I was getting the hang of this something has baffled me :S
I have an Access database, with several tables in it. Some of these are tblAddress and tblCard.
Now, I copied and pasted the code from tblAddress 's php file to tblCard 's... obviously I changed all the names and double checked etc...
These are the 2 files that access for tblCard:
- card.php
Code:
<form action="addcard.php" method="POST">
<table border = 0>
<tr>
<td>Name on Card :</td> <td> <input type='text' name='name' /></td>
</tr>
<tr>
<td>Number: </td> <td> <input type='text' name='num' /></td>
</tr>
<tr><td>Type: </td> <td> <input type='text' name='type' /></td>
</tr>
<tr><td>Expiry Date: </td> <td> <input type='text' name='ex' /></td> <td>Please enter in the form of MM/YY</td></tr>
<tr><td>Security number: </td> <td> <input type='text' name='sec' /></td> <td>This is the 3 digit code on the signature strip</td>
</tr>
<tr><td>
</td></tr>
<tr><td> <input type='submit' value='Add Card'></td> <td> </td></tr>
</form>
</table>
2.addcard.php
Code:
<?php
$name= $_POST['name'];
$num= $_POST['num'];
$type= $_POST['type'];
$ex= $_POST['ex'];
$sec= $_POST['sec'];
$conn=odbc_connect('db09','','');
$sql="INSERT INTO tblCard (username, name, type, number, exp, sec) VALUES ('$username', '$name', '$type', '$num', '$ex', '$sec')";
if (odbc_exec($conn,$sql))
{
echo "Thank you for registering a Card!";
}
else
{
echo "Unfortunately there has been a problem - please <a href='card.php'>Try again</a>";
echo $name;
echo $num;
echo $type;
echo $ex;
echo $sec;
echo $username;
}
odbc_close($conn);
?>
I just dont see when I can possibly be going wrong, but it must be something simple :S I have checked and checked and checked to make sure my field names are right both from the form and from the database and so is my table name...
Also $username is stored in a cookie and works completely in all of my other pages..
and the
echo $name;
echo $num;
echo $type;
echo $ex;
echo $sec;
echo $username;
does print out the correct fields :S
Arggghhh, help me !!