Help - Search - Members - Calendar
Full Version: Edit multiline text box
HTMLHelp Forums > Programming > Server-side Scripting
benprice234
I have a table displayed on a home page and an edit hyperlink located next to it. when the edit hyperlink is pressed the edithome page loads which conatins a multiline text box. it works perfectly however the text that is being edited is not visible in the multiline text box. I cant get my head around it any help would be greatly appreciated. The code I am using is below: I think the error could be on the line <?php echo $homename; ?>



<?php


//get the id from the previous page
$item_id=$_GET['item_id'];

//this line will get all of the fields from the stationery table
$result = mysql_query("SELECT * FROM home where homeid=$item_id");

//this will loop through each row of the query result
while ($myrow = mysql_fetch_array($result))
{

///////////////////////////////////////////
////////////initialiase each variable//////
$homeid=$myrow["homeid"];
$homename=$myrow["homename"];

///////////////////////////////////////////
///////////////////////////////////////////
?>

<form method=post action=edithome.php>
<p>
<textarea rows="4" cols="50" type="text" name="homename" value="<?php echo $homename; ?>"></textarea>
<p>

<input type="hidden" name="homeid" value="<?php echo $homeid; ?>">
<p>
<input type="submit" value="Save" name="save_item">
</form>
<?php
}
?>
CharlesEF
Seems your code builds form after form. $homename contains the data of table 'home' column 'homename'. You return all columns of data but only use 2 of them? Each form seems to have a 'Save' button but I don't see any 'edit' anywhere.

Why can't you do the same as other forms? You have a php script to run (edithome.php) when submitted so your php script can use $_POST to get the data values and place them in the edithome.php script to do with as you please.

Also, form attributes 'method' and 'action' should be enclosed in double quotes.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.