Jump to content

[SOLVED] Update and retrieve problems


livewirerules

Recommended Posts

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();

}
?>	

Link to comment
https://forums.phpfreaks.com/topic/72449-solved-update-and-retrieve-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.