frijole Posted March 11, 2008 Share Posted March 11, 2008 I am trying to save the embed HTML for a youtube video into my DB so I can call it up later. I have a set-up where I enter the HTML into a textarea and then it shows me the echoed html, which should be the video but it is not displaying. I have tried all kinds of encoding decoding stuff with no change? can anyone lead me in the right direction? I have checked everywhere that I know. If anyone knows a better way to do this I would love to hear it. Thanks. <?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 = $_POST['embedHTML']; $videoDesc = $_POST['description']; echo "<html>"; echo "<blockquote>"; echo $embedHTML; echo "</blockquote>"; echo "<br />"; echo "<blockquote>"; echo $videoDesc; echo "</blockquote>"; echo "</html>"; } } ?> Quote Link to comment Share on other sites More sharing options...
l0ve2hat3 Posted March 11, 2008 Share Posted March 11, 2008 what is it doing? do you get an error? and what is the } else { ? please show the whole code Quote Link to comment Share on other sites More sharing options...
l0ve2hat3 Posted March 11, 2008 Share Posted March 11, 2008 sorry, didnt read it right. THIS IS TESTED AND WORKS <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 if (isset($_POST['embedHTML'])||isset($_POST['description'])) { require_once("dbConnect.php"); $embedHTML = $_POST['embedHTML']; $videoDesc = $_POST['description']; echo "<html>"; echo "<blockquote>"; echo $embedHTML; echo "</blockquote>"; echo "<br />"; echo "<blockquote>"; echo $videoDesc; echo "</blockquote>"; echo "</html>"; } ?> i used this for the embedded code: <object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/2GA3a15xF0c"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/2GA3a15xF0c" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object> Quote Link to comment Share on other sites More sharing options...
frijole Posted March 11, 2008 Author Share Posted March 11, 2008 THIS IS TESTED AND WORKS I don't see what has changed from my script... Or did it just work for you? Quote Link to comment Share on other sites More sharing options...
l0ve2hat3 Posted March 11, 2008 Share Posted March 11, 2008 i removed if(!$_POST){?> but try using the embedded video i used. and yes it worked for me. what version of php are you using? and on what operating system Quote Link to comment Share on other sites More sharing options...
frijole Posted March 11, 2008 Author Share Posted March 11, 2008 I am not sure what version I am using. I am writing in Dreamweaver in windows. I tried your code and still have the same problem..... here is the link if you want to see what I see. http://www.thinksnack.com/addVideo.php MySQL Version - 5.0.45-community-log <-----from my web host Quote Link to comment Share on other sites More sharing options...
l0ve2hat3 Posted March 11, 2008 Share Posted March 11, 2008 you are escaping all quotes : <object width=\"425\" height=\"355\"><param name=\"movie\" value=\"http://www.youtube.com/v/2GA3a15xF0c\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/2GA3a15xF0c\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"355\"></embed></object> create a file called phpinfo.php and put this in it: <? phpinfp(); ?> send me a link. i believe u have magic quotes on Quote Link to comment Share on other sites More sharing options...
l0ve2hat3 Posted March 11, 2008 Share Posted March 11, 2008 actually just do this: echo "<blockquote>"; echo stripslashes($embedHTML); echo "</blockquote>"; Quote Link to comment Share on other sites More sharing options...
frijole Posted March 11, 2008 Author Share Posted March 11, 2008 your the man, thanks. I have been working on that for a while, all is good. 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.