Jump to content

Recommended Posts

Hey, I've added two new columns to a table called "rating_audio" and "rating_video" but after updating my script to post the info into the table, those two will not POST. I've checked the others by changing the data and they go through fine and update appropriately on the page.

 

Here's some of the code, maybe I'm just missing something:

>if (isset($_POST['body_film'])):
 
 $id = $_POST['id'];
 $keywords = $_POST['keywords'];
 $title = $_POST['title'];
 $list_title = $_POST['list_title'];
 $year = $_POST['year'];
 $director = $_POST['director'];
 $writer = $_POST['writer'];
 $cast = $_POST['cast'];
 $dvd_releasedate = $_POST['dvd_releasedate'];
 $theater_releasedate = $_POST['theater_releasedate'];
 $posted = $_POST['posted'];
 $retail_price = $_POST['retail_price'];
 $edition = $_POST['edition'];
 $hddvd = $_POST['hddvd'];
 $amazon = $_POST['amazon'];
 $specialfeatures = $_POST['specialfeatures'];
 $studio = $_POST['studio'];
 $body_film = $_POST['body_film'];
 $body_features = $_POST['body_features'];
 $body_audiovideo = $_POST['body_audiovideo'];
 $body_overall = $_POST['body_overall'];
 $image1 = $_POST['image1'];
 $image2 = $_POST['image2'];
 $dvd_cover = $_POST['poster'];
 $mpaa_rating = $_POST['mpaa_rating'];
 $runtime = $_POST['runtime'];
 $rating_film = $_POST['rating_film'];
 $rating_features = $_POST['rating_features'];
 $rating_audiovideo = $_POST['rating_audiovideo'];
 $rating_video = $_POST['rating_video'];
 $rating_audio = $_POST['rating_audio'];
 $rating_overall = $_POST['rating_overall'];
 $discs = $_POST['discs'];
 $chapters = $_POST['chapters'];
 $screenformat = $_POST['screenformat'];
 $audio_english = $_POST['audio_english'];
 $subtitles = $_POST['subtitles'];
 $criticid = $_POST['criticid'];
 $studios = $_POST['studios'];
 $genres = $_POST['genres'];
 $subgenres = $_POST['subgenres'];
 $audios = $_POST['audios'];
 $videos = $_POST['videos'];

 $sql = "UPDATE dvd_reviews SET
id='$id',
title='$title',
year='$year',
studio='$studio',
mpaa_rating='$mpaa_rating',
runtime='$runtime',
retail_price='$retail_price',
release_date='$dvd_releasedate',
criticid='$criticid',
posted='$posted',
dvd_cover='$dvd_cover',
rating_film='$rating_film',
rating_features='$rating_features',
rating_audiovideo='$rating_audiovideo',
rating_overall='$rating_overall',
director='$director',
writer='$writer',
cast='$cast',
theater_releasedate='$theater_releasedate',
supplemental_features='$specialfeatures',
body_film='$body_film',
body_features='$body_features',
body_audiovideo='$body_audiovideo',
image1='$image1',
image2='$image2',
keywords='$keywords',
discs='$discs',
chapters='$chapters',
screenformat='$screenformat',
audio_english='$audio_english',
subtitles='$subtitles',
amazon='$amazon',
body_overall='$body_overall',
edition='$edition',
list_title='$list_title',
hddvd='$hddvd',
rating_video='$rating_video',
rating_audio='$rating_audio'
WHERE id='$id'";

 

The first part (with $_POST) is in the order where the data entry in the script. Example:

 

id

keywords

title

list_title

etc. etc.

 

While the second part is in the order in the table.

 

Here's the code for the entry portion:

><P>Star Rating - VIDEO:
<textarea name="rating_video" rows="1" cols="10">
<?php echo $rating_video; ?></textarea></p>

<P>Star Rating - AUDIO:
<textarea name="rating_audio" rows="1" cols="10">
<?php echo $rating_audio; ?></textarea></p>

 

Appreciate any help as this is driving me nuts.

 

Like I said, I can edit anything on the page and it will post the change correctly both when I go back into the edit page and to the output page as well...

Link to post
Share on other sites

So if you put a die statement after the query to print out the query are you saying the values for rating_audio and rating_video aren't there?

 

die($sql);

 

have you tried doing: die(print_r($_POST)); under where you are checking if the body_film isset? This will show you whether or not they are in the POST array.

 

If they are in the POST array then they should be in the SQL statement. If they are in the SQL statement but not getting put into the DB then you may need to look at the field types in your DB of rating_audio and rating_video to make sure they are appropriate

 

 

 

 

Just as a side note, you don't appear to be cleaning any of your POST values before banging them into the DB... I would suggest you mysql_real_escape_string them all and intval( )'ing the ones which should only be integers... just for ease of mind.

Edited by OJB
Link to post
Share on other sites

I haven't tried those but I know the values aren't there. The output page I have, the coding to get the info from the DB is correct and I know the field types in the DB are correct (they match the other "rating_" fields exactly. rating_film, rating_features, rating_audiovideo and rating_overall contain the same type of values as rating_video and rating_audio.

 

Strange thing is, I copied all those "rating_" codes just changing for video or audio...

 

BTW, here's the entire code for that page:

><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Movieman CMS: Edit Review</title>
<meta http-equiv="content-type"
   content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php

*removed*

if (isset($_POST['body_film'])):
 
 $id = $_POST['id'];
 $keywords = $_POST['keywords'];
 $title = $_POST['title'];
 $list_title = $_POST['list_title'];
 $year = $_POST['year'];
 $director = $_POST['director'];
 $writer = $_POST['writer'];
 $cast = $_POST['cast'];
 $dvd_releasedate = $_POST['dvd_releasedate'];
 $theater_releasedate = $_POST['theater_releasedate'];
 $posted = $_POST['posted'];
 $retail_price = $_POST['retail_price'];
 $edition = $_POST['edition'];
 $hddvd = $_POST['hddvd'];
 $amazon = $_POST['amazon'];
 $specialfeatures = $_POST['specialfeatures'];
 $studio = $_POST['studio'];
 $body_film = $_POST['body_film'];
 $body_features = $_POST['body_features'];
 $body_audiovideo = $_POST['body_audiovideo'];
 $body_overall = $_POST['body_overall'];
 $image1 = $_POST['image1'];
 $image2 = $_POST['image2'];
 $dvd_cover = $_POST['poster'];
 $mpaa_rating = $_POST['mpaa_rating'];
 $runtime = $_POST['runtime'];
 $rating_film = $_POST['rating_film'];
 $rating_features = $_POST['rating_features'];
 $rating_audiovideo = $_POST['rating_audiovideo'];
 $rating_video = $_POST['rating_video'];
 $rating_audio = $_POST['rating_audio'];
 $rating_overall = $_POST['rating_overall'];
 $discs = $_POST['discs'];
 $chapters = $_POST['chapters'];
 $screenformat = $_POST['screenformat'];
 $audio_english = $_POST['audio_english'];
 $subtitles = $_POST['subtitles'];
 $criticid = $_POST['criticid'];
 $studios = $_POST['studios'];
 $genres = $_POST['genres'];
 $subgenres = $_POST['subgenres'];
 $audios = $_POST['audios'];
 $videos = $_POST['videos'];

 $sql = "UPDATE dvd_reviews SET
id='$id',
title='$title',
year='$year',
studio='$studio',
mpaa_rating='$mpaa_rating',
runtime='$runtime',
retail_price='$retail_price',
release_date='$dvd_releasedate',
criticid='$criticid',
posted='$posted',
dvd_cover='$dvd_cover',
rating_film='$rating_film',
rating_features='$rating_features',
rating_audiovideo='$rating_audiovideo',
rating_overall='$rating_overall',
director='$director',
writer='$writer',
cast='$cast',
theater_releasedate='$theater_releasedate',
supplemental_features='$specialfeatures',
body_film='$body_film',
body_features='$body_features',
body_audiovideo='$body_audiovideo',
image1='$image1',
image2='$image2',
keywords='$keywords',
discs='$discs',
chapters='$chapters',
screenformat='$screenformat',
audio_english='$audio_english',
subtitles='$subtitles',
amazon='$amazon',
body_overall='$body_overall',
edition='$edition',
list_title='$list_title',
hddvd='$hddvd',
rating_video='$rating_video',
rating_audio='$rating_audio'
WHERE id='$id'";

 if (mysql_query($sql)) {
   echo '<p>Movie details updated.</p>';
 } else {
   exit('<p>Error updating review details: ' .
       mysql_error() . '</p>');
 }

 // Delete all existing entries for this
 // review from the moviegenre table
 $ok = mysql_query("DELETE FROM moviegenre
                    WHERE movieid='$id'");
 if (!$ok) {
   exit('<p>Error removing review from all genres:' .
       mysql_error() . '</p>');
 }

 $ok2 = mysql_query("DELETE FROM movieaudio
	      WHERE movieid='$id'");

 if (!ok2) {
   exit('<p>Error removing review from all audio cats:' .
       mysql_error() . '</p>');
 }

 $ok3 = mysql_query("DELETE FROM moviepicture
	      WHERE movieid='$id'");

 if (!ok3) {
   exit('<p>Error removing review from all video cats:' .
       mysql_error() . '</p>');
 }

 $ok4 = mysql_query("DELETE FROM moviestudio
	      WHERE movieid='$id'");

 if (!ok4) {
   exit('<p>Error removing review from all studio:' .
       mysql_error() . '</p>');
 }

 $ok5 = mysql_query("DELETE FROM moviesubgenre
	      WHERE movieid='$id'");

 if (!ok5) {
   exit('<p>Error removing review from all subgenre:' .
       mysql_error() . '</p>');
 }

 if (isset($_POST['genres'])) {
   $genres = $_POST['genres'];
 } else {
   $genres = array();
 }

 if (isset($_POST['subgenres'])) {
   $subgenres = $_POST['subgenres'];
 } else {
   $subgenres = array();
 }

 if (isset($_POST['audios'])) {
   $audios = $_POST['audios'];
 } else {
   $audios = array();
 }

 if (isset($_POST['videos'])) {
   $videos = $_POST['videos'];
 } else {
   $videos = array();
 }

 if (isset($_POST['studios'])) {
   $studios = $_POST['studios'];
 } else {
   $studios = array();
 }

 foreach ($genres as $genreID) {
   $sql = "INSERT IGNORE INTO moviegenre
           SET movieid='$id', genreid='$genreID'";
   $ok = @mysql_query($sql);
   if (!$ok) {
     echo "<p>Error inserting review into genre $genreID: " .
         mysql_error() . '</p>';
   }
 }

 foreach ($audios as $audioID) {
   $sql2 = "INSERT IGNORE INTO movieaudio
           SET movieid='$id', audioid='$audioID'";
   $ok2 = @mysql_query($sql2);
   if (!$ok2) {
     echo "<p>Error inserting review into audio $audioID: " .
         mysql_error() . '</p>';
   }
 }

 foreach ($videos as $videoID) {
   $sql3 = "INSERT IGNORE INTO moviepicture
           SET movieid='$id', picid='$videoID'";
   $ok3 = @mysql_query($sql3);
   if (!$ok3) {
     echo "<p>Error inserting review into video $videoID: " .
         mysql_error() . '</p>';
   }
 }

 foreach ($studios as $studioID) {
   $sql4 = "INSERT IGNORE INTO moviestudio
           SET movieid='$id', studioid='$studioID'";
   $ok4 = @mysql_query($sql4);
   if (!$ok4) {
     echo "<p>Error inserting review into video $studioID: " .
         mysql_error() . '</p>';
   }
 }

 foreach ($subgenres as $subgenreID) {
   $sql5 = "INSERT IGNORE INTO moviesubgenre
           SET movieid='$id', subgenreid='$subgenreID'";
   $ok5 = @mysql_query($sql5);
   if (!$ok5) {
     echo "<p>Error inserting review into subgenre $subgenreID: " .
         mysql_error() . '</p>';
   }
 }

?>

<p><a href="../index.html">INDEX PAGE</a></p>

<?php else:

*removed*

 $dvd = @mysql_query(
   "SELECT id, title, list_title, year, studio, mpaa_rating, runtime, retail_price, release_date, criticid, posted, dvd_cover, rating_film, rating_features, rating_audiovideo, rating_overall, director, writer, cast, theater_releasedate, supplemental_features, body_film, body_features, body_audiovideo, image1, image2, keywords, discs, chapters, screenformat, audio_english, subtitles, amazon, body_overall, edition, hddvd FROM dvd_reviews WHERE id='$id'");
 if (!$dvd) {
   exit('<p>Error fetching review details: ' .
       mysql_error() . '</p>');
 }

 $review = mysql_fetch_array($dvd);

 $id = $review['id'];
 $title = $review['title'];
 $list_title = $review['list_title'];
 $year = $review['year'];
 $studio = $review['studio'];
 $mpaa_rating = $review['mpaa_rating'];
 $runtime = $review['runtime'];
 $retail_price = $review['retail_price'];
 $dvd_releasedate = $review['release_date'];
 $cid = $review['criticid'];
 $posted = $review['posted'];
 $poster = $review['dvd_cover'];
 $rating_film = $review['rating_film'];
 $rating_features = $review['rating_features'];
 $rating_audiovideo = $review['rating_audiovideo'];
 $rating_overall = $review['rating_overall'];
 $director = $review['director'];
 $writer = $review['writer'];
 $cast = $review['cast'];
 $theater_releasedate = $review['theater_releasedate'];
 $specialfeatures = $review['supplemental_features'];
 $body_film = $review['body_film'];
 $body_features = $review['body_features'];
 $body_audiovideo = $review['body_audiovideo'];
 $image1 = $review['image1'];
 $image2 = $review['image2'];
 $keywords = $review['keywords'];
 $discs = $review['discs'];
 $chapters = $review['chapters'];
 $screenformat = $review['screenformat'];
 $audio_english = $review['audio_english'];
 $subtitles = $review['subtitles'];
 $amazon = $review['amazon'];
 $body_overall = $review['body_overall'];
 $edition = $review['edition'];
 $hddvd = $review['hddvd'];
 $rating_video = $review['rating_video'];
 $rating_audio = $review['rating_audio'];

 // Convert HTML special characters
 // in database value for use in
 // an HTML document.
 $id = htmlspecialchars($id);
 $title = htmlspecialchars($title);
 $list_title = htmlspecialchars($list_title);
 $studio = htmlspecialchars($studio);
 $mpaa_rating = htmlspecialchars($mpaa_rating);
 $retail_price = htmlspecialchars($retail_price);
 $dvd_releasedate = htmlspecialchars($dvd_releasedate);
 $poster = htmlspecialchars($poster);
 $rating_film = htmlspecialchars($rating_film);
 $rating_features = htmlspecialchars($rating_features);
 $rating_audiovideo = htmlspecialchars($rating_audiovideo);
 $rating_overall = htmlspecialchars($rating_overall);
 $director = htmlspecialchars($director);
 $writer = htmlspecialchars($writer);
 $cast = htmlspecialchars($cast);
 $theater_releasedate = htmlspecialchars($theater_releasedate);
 $specialfeatures = htmlspecialchars($specialfeatures);
 $body_film = htmlspecialchars($body_film);
 $body_features = htmlspecialchars($body_features);
 $body_audiovideo = htmlspecialchars($body_audiovideo);
 $image1 = htmlspecialchars($image1);
 $image2 = htmlspecialchars($image2);
 $keywords = htmlspecialchars($keywords);
 $screenformat = htmlspecialchars($screenformat);
 $audio_english = htmlspecialchars($audio_english);
 $subtitles = htmlspecialchars($subtitles);
 $amazon = htmlspecialchars($amazon);
 $body_overall = htmlspecialchars($body_overall);
 $edition = htmlspecialchars($edition);
 $hddvd = htmlspecialchars($hddvd);
 $rating_video = htmlspecialchars($rating_video);
 $rating_audio = htmlspecialchars($rating_audio);

 // Get lists of critics and genres for
 // the select box and checkboxes.
 $critics = @mysql_query('SELECT id, name FROM critic');
 if (!$critics) {
   exit('<p>Unable to obtain critic list from the database.</p>');
 }

 $genres = @mysql_query('SELECT id, category FROM genre ORDER BY category');
 if (!$genres) {
   exit('<p>Unable to obtain genre list from the database.</p>');
 }

 $subgenres = @mysql_query('SELECT id, subcategory FROM subgenre ORDER BY subcategory');
 if (!$subgenres) {
   exit('<p>Unable to obtain genre list from the database.</p>');
 }

 $audios = @mysql_query('SELECT id, mix FROM audio ORDER BY mix');
 if (!$audios) {
   exit('<p>Unable to obtain audio list from the database.</p>');
 }

 $videos = @mysql_query('SELECT id, format FROM video ORDER BY format');
 if (!$videos) {
   exit('<p>Unable to obtain video list from the database.</p>');
 }

 $studios = @mysql_query('SELECT id, name FROM studio ORDER BY name');
 if (!$videos) {
   exit('<p>Unable to obtain studio list from the database.</p>');
 }
?>

Part 2:

 

>
<B><?php echo $title; ?></B><br /><br />

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<p>Movie ID:<br />
<textarea name="id" rows="1" cols="30">
<?php echo $id; ?></textarea></p>

<p>Keywords:<br />
<textarea name="keywords" rows="4" cols="45">
<?php echo $keywords; ?></textarea></p>

<p>Movie Title:<br />
<textarea name="title" rows="1" cols="45">
<?php echo $title; ?></textarea></p>

<p>Movie List Title:<br />
<textarea name="list_title" rows="1" cols="45">
<?php echo $list_title; ?></textarea></p>

<p>Year:<br />
<textarea name="year" rows="1" cols="8">
<?php echo $year; ?></textarea></p>

<p>Director:<br />
<textarea name="director" rows="1" cols="30">
<?php echo $director; ?></textarea></p>

<p>Writers:<br />
<textarea name="writer" rows="5" cols="70">
<?php echo $writer; ?></textarea></p>

<p>Cast:<br />
<textarea name="cast" rows="10" cols="70">
<?php echo $cast; ?></textarea></p>

<p>DVD Release Date:<br />
<textarea name="dvd_releasedate" rows="1" cols="30">
<?php echo $dvd_releasedate; ?></textarea></p>

<p>Theater Release Date:<br />
<textarea name="theater_releasedate" rows="1" cols="30">
<?php echo $theater_releasedate; ?></textarea></p>

<p>Review Posted:<br />
<textarea name="posted" rows="1" cols="30">
<?php echo $posted; ?></textarea></p>

<p>Retail Price:<br />
<textarea name="retail_price" rows="1" cols="10">
<?php echo $retail_price; ?></textarea></p>

<p>DVD Edition:<br />
<textarea name="edition" rows="1" cols="20">
<?php echo $edition; ?></textarea></p>

<p>HD-DVD? (y):<br />
<textarea name="hddvd" rows="1" cols="10">
<?php echo $hddvd; ?></textarea></p>

<p>Amazon Tag:<br />
<textarea name="amazon" rows="1" cols="15">
<?php echo $amazon; ?></textarea></p>

<p>Special Features:<br />
<textarea name="specialfeatures" rows="10" cols="70">
<?php echo $specialfeatures; ?></textarea></p>

<p>Studio:<br />
<textarea name="studio" rows="1" cols="30">
<?php echo $studio; ?></textarea></p>

<p>Film Review Section:<br />
<textarea name="body_film" rows="8" cols="70">
<?php echo $body_film; ?></textarea></p>

<p>Special Features Review Section:<br />
<textarea name="body_features" rows="15" cols="70">
<?php echo $body_features; ?></textarea></p>

<p>Audio-Video Review Section:<br />
<textarea name="body_audiovideo" rows="15" cols="70">
<?php echo $body_audiovideo; ?></textarea></p>

<p>Overall Review Section:<br />
<textarea name="body_overall" rows="15" cols="70">
<?php echo $body_overall; ?></textarea></p>

<p>Image #1:<br />
<textarea name="image1" rows="1" cols="45">
<?php echo $image1; ?></textarea></p>

<p>Image #2:<br />
<textarea name="image2" rows="1" cols="45">
<?php echo $image2; ?></textarea></p>

<p>DVD Cover:<br />
<textarea name="poster" rows="1" cols="45">
<?php echo $poster; ?></textarea></p>

<P>MPAA Rating:<br />
<textarea name="mpaa_rating" rows="1" cols="15">
<?php echo $mpaa_rating; ?></textarea></p>

<p>Runtime:<br />
<textarea name="runtime" rows="1" cols="8">
<?php echo $runtime; ?></textarea></p>

<P>Star Rating - FILM:
<textarea name="rating_film" rows="1" cols="10">
<?php echo $rating_film; ?></textarea></p>

<P>Star Rating - SPECIAL FEATURES:
<textarea name="rating_features" rows="1" cols="10">
<?php echo $rating_features; ?></textarea></p>

<P>Star Rating - AUDIO AND VIDEO:
<textarea name="rating_audiovideo" rows="1" cols="10">
<?php echo $rating_audiovideo; ?></textarea></p>

<P>Star Rating - VIDEO:
<textarea name="rating_video" rows="1" cols="10">
<?php echo $rating_video; ?></textarea></p>

<P>Star Rating - AUDIO:
<textarea name="rating_audio" rows="1" cols="10">
<?php echo $rating_audio; ?></textarea></p>

<P>Star Rating - OVERALL:
<textarea name="rating_overall" rows="1" cols="10">
<?php echo $rating_overall; ?></textarea></p>

<b>TECHNICAL INFORMATION</b><br />
<p>Number of Discs:<br />
<textarea name="discs" rows="1" cols="8">
<?php echo $discs; ?></textarea></p>

<p>Number of Chapters:<br />
<textarea name="chapters" rows="1" cols="8">
<?php echo $chapters; ?></textarea></p>

<p>Screen Format (Widescreen, Fullscreen):<br />
<textarea name="screenformat" rows="1" cols="45">
<?php echo $screenformat; ?></textarea></p>

<p>Audio (English):<br />
<textarea name="audio_english" rows="3" cols="70">
<?php echo $audio_english; ?></textarea></p>

<p>Subtitles:<br />
<textarea name="subtitles" rows="3" cols="70">
<?php echo $subtitles; ?></textarea></p>

<b>End of TECHNICAL INFO</b><br /><br />

<p>Critic:<br />
<textarea name="criticid" rows="1" cols="8">
<?php echo $cid; ?></textarea></p>

<p>In Studios:<br />
<?php
 while ($studio = mysql_fetch_array($studios)) {
   $sid = htmlspecialchars($studio['id']);
   $sname = htmlspecialchars($studio['name']);

   // Check if the review is in this studio
   $result = @mysql_query(
     "SELECT * FROM moviestudio
      WHERE movieid='$id' AND studioid='$sid'");
   if (!$result) {
     exit('<p>Error fetching review details: ' .
         mysql_error() . '</p>');
   }

   // mysql_num_rows gives the number of entries
   // in a result set. In this case, if the result
   // contains one or more rows, the condition
   // below will evaluate to true to indicate that
   // the joke does belong to the category, and the
   // checkbox should be checked.
   if (mysql_num_rows($result)) {
     echo "<input type='checkbox' checked='checked' name='studios[]' value='$sid' />$sname<br />\n";
   } else {
     echo "<input type='checkbox' name='studios[]' value='$sid' />$sname<br />\n";
   }
 }
?>
</p>

<p>In Genres:<br />
<?php
 while ($genre = mysql_fetch_array($genres)) {
   $gid = htmlspecialchars($genre['id']);
   $gname = htmlspecialchars($genre['category']);

   // Check if the review is in this genre
   $result = @mysql_query(
     "SELECT * FROM moviegenre
      WHERE movieid='$id' AND genreid='$gid'");
   if (!$result) {
     exit('<p>Error fetching review details: ' .
         mysql_error() . '</p>');
   }

   // mysql_num_rows gives the number of entries
   // in a result set. In this case, if the result
   // contains one or more rows, the condition
   // below will evaluate to true to indicate that
   // the joke does belong to the category, and the
   // checkbox should be checked.
   if (mysql_num_rows($result)) {
     echo "<input type='checkbox' checked='checked' name='genres[]' value='$gid' />$gname<br />\n";
   } else {
     echo "<input type='checkbox' name='genres[]' value='$gid' />$gname<br />\n";
   }
 }
?>
</p>

<p>In Sub-Genres:<br />
<?php
 while ($subgenre = mysql_fetch_array($subgenres)) {
   $sgid = htmlspecialchars($subgenre['id']);
   $sgname = htmlspecialchars($subgenre['subcategory']);

   // Check if the review is in this genre
   $result4 = @mysql_query(
     "SELECT * FROM moviesubgenre
      WHERE movieid='$id' AND subgenreid='$sgid'");
   if (!$result4) {
     exit('<p>Error fetching review details: ' .
         mysql_error() . '</p>');
   }

   if (mysql_num_rows($result4)) {
     echo "<input type='checkbox' checked='checked' name='subgenres[]' value='$sgid' />$sgname<br />\n";
   } else {
     echo "<input type='checkbox' name='subgenres[]' value='$sgid' />$sgname<br />\n";
   }
 }
?>
</p>

<p>In Audio:<br />
<?php
 while ($audio = mysql_fetch_array($audios)) {
   $aid = $audio['id'];
   $aname = htmlspecialchars($audio['mix']);

   $result2 = @mysql_query(
     "SELECT * FROM movieaudio
      WHERE movieid='$id' AND audioid='$aid'");
   if (!$result2) {
     exit('<p>Error fetching review details: ' .
         mysql_error() . '</p>');
   }

   if (mysql_num_rows($result2)) {
     echo "<input type='checkbox' checked='checked' name='audios[]' value='$aid' />$aname<br />\n";
   } else {
     echo "<input type='checkbox' name='audios[]' value='$aid' />$aname<br />\n";
   }
 }
?>
</p>

<p>In Video:<br />
<?php
 while ($video = mysql_fetch_array($videos)) {
   $videoid = $video['id'];
   $videoname = htmlspecialchars($video['format']);

   $result3 = @mysql_query(
     "SELECT * FROM moviepicture
      WHERE movieid='$id' AND picid='$videoid'");
   if (!$result3) {
     exit('<p>Error fetching review details: ' .
         mysql_error() . '</p>');
   }

   if (mysql_num_rows($result3)) {
     echo "<input type='checkbox' checked='checked' name='videos[]' value='$videoid' />$videoname<br />\n";
   } else {
     echo "<input type='checkbox' name='videos[]' value='$videoid' />$videoname<br />\n";
   }
 }
?>
</p>
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="submit" value="SUBMIT" />
</form>

<?php endif; ?>

</body>
</html>

 

Edit: Sorry about the horrizonal scroll on this one...

 

Also, the page I'm doing all this on is an edit page for my reviews. What happens is, all those php echos get the values from the DB for that particular review so I can edit whatever I want (spelling errors, whatever) and then submit it and wala, all done.

 

I also tried entering the data on another page where I post new reviews and again, the values do not seem to post.

Edited by TheMovieman
Link to post
Share on other sites

You dont seem to be grabbing the rating_audio and rating_video in your select:

 

>$dvd = @mysql_query("SELECT id, title, list_title, year, studio, mpaa_rating, runtime, retail_price, release_date, criticid, posted, dvd_cover, rating_film, rating_features, rating_audiovideo, rating_overall, director, writer, cast, theater_releasedate, supplemental_features, body_film, body_features, body_audiovideo, image1, image2, keywords, discs, chapters, screenformat, audio_english, subtitles, amazon, body_overall, edition, hddvd FROM dvd_reviews WHERE id='$id'");

 

 

 

As a test I also deleted all the stuff that grabs from other tables so I was left with just the form.

 

I filled in all the details... then put die(print_r($_POST)); at the top of the page and pressed submit... ALL values were infact in the POST array including rating_audio and rating_video...

 

So i guess its because of the select query

 

 

 

 

I have also noticed the following issue with your code:

 

 

>$studios = @mysql_query('SELECT id, name FROM studio ORDER BY name');
if (!$videos) {
exit('<p>Unable to obtain studio list from the database.</p>');
}

 

should be if(!$studios) not if(!$videos)

 

 

 

also, why are you using textareas for everything?

Edited by OJB
Link to post
Share on other sites

Unbelievable! THANK YOU. I cannot believe I forgot that! *shakes head*

 

"also, why are you using textareas for everything?"

That's where the info from the DB gets filled in so I can, if need be, edit it.

 

Now all I have to do is figure out what I missed on my review page that wouldn't print those... Probably something simple, so I'll give it another sweep.

Edited by TheMovieman
Link to post
Share on other sites

No problemo...

 

 

I meant why dont you use text fields, radio buttons, drop down lists etc....

 

Like for HD-DVD I would personally use a radio button

 

For things like movie title I would use text field instead....

 

 

Text areas come in handy for the review sections obviously because they are lengthy pieces of writing....

 

Anyway, glad I could help...

 

Dont forget to sanitise your data too as I mentioned at the bottom of my first post!

Link to post
Share on other sites

Well, I tried doing the drop down on a few of them but for some reason when I tried changing it, they wouldn't post the new one (ie the star ratings). This was a long, long time ago so I might take another look at it once I get some free time but right now I've got a ton of DVDs to review. ;)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...