Right, first of all I'm new to PHP and I was trying if I could update information in table via a form.
So here's the problem:
I was unable to UPDATE my existing data in a table through a form using this code:
$updateFN = "UPDATE person SET firstName='$_POST[updateFN]' WHERE personID='$_POST[perID]'";
But If I would change from personID='$_POST[perID]' to personID='1' , surprisingly it works. So why did the perID variable failed to be detected? personID is a PRIMARY_KEY, AUTO_INCREMENT and NOT NULL in the respective table.
This is the error messages I've been getting:
Notice: Undefined index: perID in C:\...updatinginfo.php on line 4
Notice: Undefined index: perID in C:\...updatinginfo.php on line 5
Notice: Undefined index: perID in C:\...updatinginfo.php on line 6
Warning: mysql_query() expects at most 2 parameters, 3 given in C:\...processinginfo.php on line 9
//line 9
mysql_query($updateFN, $updateLN, $updateA);
I've even tried to verify the error using this method: echo ($updateFN ." \n". $updateLN ." \n ". $updateA);
But still I am unable to solve the issue. This is what it printed out:
UPDATE person SET firstName='Bob' WHERE personID='' UPDATE person SET lastName='Smith' WHERE personID='' UPDATE person SET Age='58' WHERE personID=''
So why isn't there any value for the personID?
Here's the source code for the form:
<form action="updatinginfo.php" method="post">
Please Enter your ID number stated above: <input type="textbox" name"perID" />
First Name: <input type="textbox" name="updateFN" />
Last Name: <input type="textbox" name="updateLN" />
Age: <input type="textbox" name="sage" />
<input type="submit" value="Update" />
</form>