marukochan Posted March 5, 2007 Share Posted March 5, 2007 Please help me. I want to display the value of a query in a text box of a form. How do I write it? The query $query = mysql_query("SELECT * FROM project WHERE project_id = '$project_id'"); Extract the value while($row=mysql_fetch_array($query)){ To display, I wrote ( a part of it) <tr> <td>Location</td> <td>:</td> <td><input type="text" name="location" value="<? echo $row['project_loc'] ?>"></td> </tr> But it didn't work. I'm not exactly sure how to write php within html codes. Please help. Link to comment https://forums.phpfreaks.com/topic/41203-solved-how-to-write-it-correctly/ Share on other sites More sharing options...
mmarif4u Posted March 5, 2007 Share Posted March 5, 2007 Do it like this : $query = "SELECT * FROM project where project_id = '$project_id' "; $result = mysql_query($query) or die(mysql_error()); $project_loc=$row->Project_loc; while($row=mysql_fetch_array($query)){ Echo it like this: <td><input type="text" name="location" value="<?php echo $project-loc ?>"></td> Link to comment https://forums.phpfreaks.com/topic/41203-solved-how-to-write-it-correctly/#findComment-199599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.