frijole Posted March 8, 2008 Share Posted March 8, 2008 I am setting up a content management script here where I can add videos to my database, everything is working here. I am trying to come up with a way to view the submitted video. and description before it gets added to the database to make sure everything is correct. Any ideas? <?php if(!$_POST){?> <html> <table> <tr> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> Embed HTML:</td> <td> <textarea rows="5" cols="50" wrap="virtual" name="embedHTML"> Enter Embed HTML Here </textarea></td> </tr> <tr> <td>Description: </td> <td><textarea rows="5" cols="50" wrap="physical" name="description"> Describe The Video Here </textarea></td> </tr> <tr> <td><input type="submit" value="Add Video!"></form></td> </tr> </table> </html> <?php } else { if (isset($_POST['embedHTML'])||isset($_POST['description'])) { require_once("dbConnect.php"); $embedHTML = trim(mysql_real_escape_string($_POST['embedHTML'])); $videoDesc = trim(mysql_real_escape_string($_POST['description'])); $query = "INSERT INTO videos (embed_html, description) VALUES ('$embedHTML', '$videoDesc')"; $result2=mysql_query($query) or die(mysql_error()); } if($result2){ echo "video added to the DB!";} elseif(empty($result2)){ echo "The Fields Are empty";} } ?> Quote Link to comment Share on other sites More sharing options...
phpretard Posted March 8, 2008 Share Posted March 8, 2008 Add it to a different database just for you. After review move it to the main and delete it. No good? Quote Link to comment Share on other sites More sharing options...
peranha Posted March 8, 2008 Share Posted March 8, 2008 You could add a field. Insert a 0 in it by default and after you view it set it to 1. On all pages search for videos with a 1 in this field. Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted March 8, 2008 Share Posted March 8, 2008 redirect the form to "whatever.php?a=review" <?php if($action == 'review'){ echo $_POST['embedHTML']; echo $_POST['description']; echo 'Like what you see? <a href="whatever.php?a=confirmed">Upload</a> video!'; } if($action == 'confirmed'){ if (isset($_POST['embedHTML'])||isset($_POST['description'])) { require_once("dbConnect.php"); $embedHTML = trim(mysql_real_escape_string($_POST['embedHTML'])); $videoDesc = trim(mysql_real_escape_string($_POST['description'])); $query = "INSERT INTO videos (embed_html, description) VALUES ('$embedHTML', '$videoDesc')"; $result2=mysql_query($query) or die(mysql_error()); } if($result2){ echo "video added to the DB!";} elseif(empty($result2)){ echo "The Fields Are empty";} }} ?> Quote Link to comment Share on other sites More sharing options...
unsider Posted March 8, 2008 Share Posted March 8, 2008 You could add a field. Insert a 0 in it by default and after you view it set it to 1. On all pages search for videos with a 1 in this field. This is the method I have used in the past, although it's not very effective when you have hundreds of entries piling up on you. Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted March 8, 2008 Share Posted March 8, 2008 ya that field set to 0 is probably the best way to go. Just be sure to record the date it was uploaded in the same table. Because then you could create a script that cleared unconfirmed videos that have been in the database for more than a day. Quote Link to comment Share on other sites More sharing options...
frijole Posted March 8, 2008 Author Share Posted March 8, 2008 thanks for all the ideas, I think I am going to try to redirect back to the original file where I add the video and use GET to echo the video before adding it to the DB. When I figure it out, ill post it here. Thanks again. 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.