jnerotrix Posted December 4, 2008 Share Posted December 4, 2008 Ok I have the code ready i just need it to be correctly coded so If form Submitted Display data else display form heres the code <?php $numTimes = (isset($_POST['times']) && is_numeric($_POST['times']))?$_POST['times']:10; $shorturl = $_POST['url']; $autoplay = "&autoplay=1"; $reloadtime = $_POST['reloadtime']; $setwidth = $_POST['setwidth']; $setheight = $_POST['setheight']; $fullurl = "http://www.youtube.com/watch?v=$shorturl" $shorturl = $_POST['url']; $fullurl = "http://www.youtube.com/watch?v=$shorturl" function check_if_valid($fullurl) { $res = (($check = @fopen($fullurl, ‘r’)) === false) ? false : @fclose($check); return ($res == TRUE) ? VIDEO_IS_VALID:VIDEO_IS_INVALID ; } echo '<html>'; echo '<head>'; echo '<meta http-equiv="refresh" content="$reloadtime">'; echo '</head> echo '<title> Get More Views On Your Video </title>'; for ($i=0; $i < $numTimes; $i++) { echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/$shorturl&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$shorturl&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="$setwidth" height="$setheight"></embed></object>'; } ?> <table border="1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <tr> <td>Video Url:<input type="text" readonly="1" value="http://www.youtube.com/watch?v="><input type="Text" name="url"></td> </tr> <tr> <td>(Number)<input type="text" name="times" value="10"> of Times to Display Video in <input type="text" name="reloadtime" value="5">(Seconds)</td> </tr> <tr> <td>Set Width <input type="text" name="setwidth" value="425"></td> <td>Set Height <input type="text" name="setheight" value="344"></td> </tr> <tr> <td align="center" valign="center"><input type="submit" value="Submit"></td> </tr> </form </table> Quote Link to comment https://forums.phpfreaks.com/topic/135583-solved-form-submit-to-self/ Share on other sites More sharing options...
flyhoney Posted December 5, 2008 Share Posted December 5, 2008 Give your submit button a name, like: <input type="submit" name="action" value="Submit"> And then wrap all your code like this: if ($_POST['action'] == 'Submit') { // add code that you only want to run // if the form was submitted here } Quote Link to comment https://forums.phpfreaks.com/topic/135583-solved-form-submit-to-self/#findComment-706355 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.