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";} } ?> Link to comment https://forums.phpfreaks.com/topic/95026-view-submission-before-entering-db/ 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? Link to comment https://forums.phpfreaks.com/topic/95026-view-submission-before-entering-db/#findComment-486760 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. Link to comment https://forums.phpfreaks.com/topic/95026-view-submission-before-entering-db/#findComment-486762 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";} }} ?> Link to comment https://forums.phpfreaks.com/topic/95026-view-submission-before-entering-db/#findComment-486778 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. Link to comment https://forums.phpfreaks.com/topic/95026-view-submission-before-entering-db/#findComment-486782 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. Link to comment https://forums.phpfreaks.com/topic/95026-view-submission-before-entering-db/#findComment-486784 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. Link to comment https://forums.phpfreaks.com/topic/95026-view-submission-before-entering-db/#findComment-486819 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.