i73 Posted February 3, 2014 Share Posted February 3, 2014 youtube.com/watch?v=vdasdwd I just need to pass the variable 'v' over to the post form <form id='upload' action='video.php' method='post' accept-charset='UTF-8'"> <fieldset class='textbox'> <input id='youtube_code' name='youtube_code' value='' type='youtube_code' placeholder='URL of youtube video' maxlength='100' style='background-color:#555;color:#000; width:50%;'> <input type="submit" name="submit" value="Submit"> </fieldset> </form> How could I do that on video.php is it like? $youtube_code=$_POST['youtube_code']; or $youtube_code=$_POST['v']; Thanks for your help! Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted February 3, 2014 Share Posted February 3, 2014 Is this what you're looking for: <input id='youtube_code' name='youtube_code' value='<?php echo $_GET['v']; ?>' type='text' placeholder='URL of youtube video' maxlength='100' style='background-color:#555;color:#000; width:50%;'> Note that I changed the input type to "text". Quote Link to comment Share on other sites More sharing options...
i73 Posted February 3, 2014 Author Share Posted February 3, 2014 (edited) Is this what you're looking for: <input id='youtube_code' name='youtube_code' value='<?php echo $_GET['v']; ?>' type='text' placeholder='URL of youtube video' maxlength='100' style='background-color:#555;color:#000; width:50%;'> Note that I changed the input type to "text". Yes! thank you, I was in a copy paste frenzy when I changed the type :/ But the code wont pass the variable "v" to the video.php script. is there a way I can do that? I understand the concept of what you are saying there, I just don't see how it can just pass that variable over the post. I have been trying to do this all day :,( Edited February 3, 2014 by i73 Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 3, 2014 Share Posted February 3, 2014 (edited) When the html form has been submited from the client (browser) to the application server, you should grab this value from the app server using some server side language like php for instance and which will send the value to database server. Then you should grab the value back from this database and write it down to application server which will pass the value to the client (browser). That's all you have to do Edited February 3, 2014 by jazzman1 Quote Link to comment Share on other sites More sharing options...
i73 Posted February 3, 2014 Author Share Posted February 3, 2014 When the html form has been submited from the client (browser) to the application server, you should grab this value from the app server using some server side language like php for instance and which will send the value to database server. Then you should grab the value back from this database and write it down to application server which will pass the value to the client (browser). That's all you have to do Yeah, I have that. I have everything but this done. if (isset($_POST['submit'])){ $user_ip=$_SERVER['REMOTE_ADDR']; $video_name=$_POST['video_name']; *ect } I just need to know how to grab that variable V on this script. :/ Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted February 3, 2014 Share Posted February 3, 2014 (edited) if (isset($_POST['submit'])){ $user_ip=$_SERVER['REMOTE_ADDR']; $video_name=$_POST['video_name']; echo "<a href=http://youtube.com/watch?v=$video_name>Video Name</a>"; } Edited February 3, 2014 by jazzman1 Quote Link to comment Share on other sites More sharing options...
i73 Posted February 3, 2014 Author Share Posted February 3, 2014 (edited) Lol, I have the user put in the youtube URL into a text box. Lets say it is, http://www.youtube.com/watch?v= J4o2vOdapms I need "v=#######" so the value of V . I will be dropping the www.youtube.com Is there a way to take that from the post script on the next php file? I know I cant use a $_post Would a $_get work some way? Well this site auto loads the V=####### Edited February 3, 2014 by i73 Quote Link to comment Share on other sites More sharing options...
Solution i73 Posted February 3, 2014 Author Solution Share Posted February 3, 2014 I got it! thanks for your help!!! $link = "http://www.youtube.com/watch?v=oHg5SJYRHA0&lololo"; $video_id = explode("?v=", $link); // For videos like http://www.youtube.com/watch?v=... if (empty($video_id[1])) $video_id = explode("/v/", $link); // For videos like http://www.youtube.com/watch/v/.. $video_id = explode("&", $video_id[1]); // Deleting any other params $video_id = $video_id[0]; 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.