livewirerules Posted October 9, 2007 Share Posted October 9, 2007 i have some problems with my php script Update and retrieve problem. The following code is to edit a movie detail form.the problem is first when i click edit it displays the current available data in the input text fields.But none of the details are displayed in the text area. when i enter the new values for the fields to update,i get the success message but none of the info are updated in the database.can someone pls help me to fix this. <?php include("adminnav.html"); ?> <div id="main"> <a name="TemplateInfo"></a> <h1>Edit movie </h1> <p><strong>Edit movies </strong></p> <?php echo $title; ?> </p> <form action="editmovie.php" method="post" id="form1"> <p>Title <input name="title" type="text" id="title" value="<?php echo $title; ?>"size="40" /> </p> <p>Director <input name="director" type="text" id="director" value="<?php echo $director; ?>"size="40" /> </p> <p>Writer <input name="writer" type="text" id="writer" value="<?php echo $writer; ?>" size="40" /> </p> <p>Image <?php $image_html ?> </p> <p>Release date <input name="date" type="text" id="date" value="<?php echo $release; ?>" size="20" /> </p> <p>Cast <input name="cast" cols="40" rows="5" id="cast" value="<?php echo $cast; ?>" /> </p> <p>Plot <textarea name="plot" cols="40" rows="3" id="plot" value="<?php echo $plot; ?>"></textarea> </p> <p>Other Info <textarea name="otherinfo" cols="40" rows="5" id="otherinfo" value="<?php echo $otherinfo; ?>"></textarea> Download links </p> <p> <textarea name="textarea" cols="40" rows="5" id="textarea" value="<?php echo $links; ?>"></textarea> </p> <p> <input type="submit" name="editmovie" value="Edit it" /> <input type="reset" name="Submit2" value="Reset" /> </p> </form> <h3> </h3> </div> <?php if (isset($_POST['editmovie'])) { $sql="UPDATE `movie_info`SET id='', title='$_POST[title]', director='$_POST[director]', writer='$_POST[writer]', image='', date='$_POST[date]', cast='$_POST[cast]', plot='$_POST[plot]', otherinfo='$_POST[otherinfo]' WHERE id='$id'"; $result=mysql_query($sql)or die(mysql_error()); echo "Success"; header("refresh:3;url=manage_movies.php"); exit(); } ?> Quote Link to comment Share on other sites More sharing options...
haaglin Posted October 9, 2007 Share Posted October 9, 2007 Place the values between the textarea tags, not as a value. Like this: <textarea name="textarea" cols="40" rows="5" id="textarea"><?php echo $links; ?></textarea> Quote Link to comment Share on other sites More sharing options...
livewirerules Posted October 10, 2007 Author Share Posted October 10, 2007 thanks mannn Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.