CageyJ0nnY Posted May 20, 2010 Share Posted May 20, 2010 Hello, I cannot figure out how to populate a text box with the result from an array?? The idea is that this is an update form, so the user can amend a property. Heres my first attempt that doesnt work: <?php $conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet688468845'); mysql_select_db('jjennings3db', $conn); $id = mysql_real_escape_string($_GET[id]); $sql = "SELECT PropertyName, Location, SalePrice FROM tblProperties WHERE id={$id}";$result1 = mysql_query($sql, $conn); $updateproperty = mysql_fetch_array($result1); ?> <html> <head> <title>Update a Property</title> </head> <body> <form method="post" action="http://jjennings3.bimserver2.com/siteadmin2.php"> <p>Property Name: <input name= <?php echo $updateproperty['PropertyName']; ?> type="text"></p> <p>Location: <input name="Location" type="text"></p> <p>No of Bedrooms: <input name="NoofBedrooms" type="text"></p> <p>Property Price: <input name="Saleprice" type="text"></p> <p>Let Price:<input name="LetPrice" type ="text"></p> <p>Garden Size: <input name="GardenSize" type ="text"></p> <p><input type="submit" name="Submit" value="Update Record"></p> <p><a href = "http://jjennings3.bimserver2.com/update-main.php"></p> <li>Back</li> </form> </body> </html> Thanks for looking Jonny Link to comment https://forums.phpfreaks.com/topic/202355-text-boxs-and-array-storage-help/ Share on other sites More sharing options...
ale8oneboy Posted May 20, 2010 Share Posted May 20, 2010 Take a look at this line: <p>Property Name: <input name= <?php echo $updateproperty['PropertyName']; ?> type="text"></p> I believe your wanting to populate the value instead of the name. Maybe rewrite as: <p>Property Name: <input name="PropertyName" value="<?php echo $updateproperty['PropertyName']; ?>" type="text"></p> Did that work? Link to comment https://forums.phpfreaks.com/topic/202355-text-boxs-and-array-storage-help/#findComment-1061032 Share on other sites More sharing options...
CageyJ0nnY Posted May 20, 2010 Author Share Posted May 20, 2010 I have changed it to what you suggested but it still wont work =[, im at a loss. thanks for the help Link to comment https://forums.phpfreaks.com/topic/202355-text-boxs-and-array-storage-help/#findComment-1061042 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.