I understand the title is pretty ambiguous so let me explain in more detail. I am using PHP to output a form which will display certain user information, the information is that which the user had previously stored in the database. This part of the code is working fine and the data is being displayed as I wish. Once the data is displayed in the input boxes, I want the user to be able to edit the information and then once the user clicks the submit button the updateuserinfo.php script will be called:
while($return = mysql_fetch_assoc($result)) {
echo "<form action=UpdateUserInfo.php method=post>";
echo "<p> First Name: <input type=text name=firstname value= ".$return['FirstName']."/></p>";
echo "<p> Surname: <input type=text value= ".$return['Surname']." /></p>";
echo "<p> House Number: <input type=number value= ".$return['HouseNumber']." /></p>";
echo "<p> Address Line One: <input type=text value= ".$return['AddressLineOne']." /></p>";
echo "<p> Address Line Two: <input type=text value= ".$return['AddressLineTwo']." /></p>";
echo "<p> County: <input type=text value= ".$return['County']." /></p>";
echo "<p> Phone Number: <input type=number value= " .$return['PhoneNumber']." /></p>";
echo "<p> Email: <input type=email value= ".$return['Email']." /></p>";
echo "<p> Username: <input type=text value= ".$return['Username']." /></p>";
echo "<p> Password: <input type=password value= ".$return['Password']." /></p>";
echo "<p> User Type: <input type=text value= ".$return['UserType']." /></p>";
echo "<input id=submit type=submit value='Update Info' Info />";
echo "</form>";
In the script found in updateuserinfo.php I was hoping I could firstly display the users info i.e what the user has changed the input box values to and then update the database if the user confirms the changes. I am confident I will be able to update the information stored on the database as this is a simple SQL query but the problem I am having is that I can not display the information found in the input boxes when the user has made changes. I thought I could apply a name attribute to each input tag, like I have done with 'firstname' and then use:
echo "<p>First Name: " $_POST[firstname] "</p>";
in the updateuserinfo.php in order to display the information the user has entered in the input box. However this is not working. Any suggestions would be greatly appreciated as I'm extremely new to programming in PHP. Thanks in advance.
First Name: " . $_POST["firstname"] . "
"; is shown here: First Name: " . $_POST["firstname"] . " "; ?> so clearly the post function is not working correctly but I am not sure why. Any ideas what could be the problem? Thanks again – user3298004 Feb 14 '14 at 16:52