Jump to content

[SOLVED] Undefined index: action in


jnerotrix

Recommended Posts

I got This Error

 

Notice: Undefined index: action in /www/rack111.com/m/y/t/mytestsite/htdocs/youtube/index.php on line 6

 

in this code

 

<title> Up Your Video Views </title>
<center>

<?php

if($_POST['action'] == 'Submit') {
   
$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'];
$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 '<meta http-equiv="refresh" content="$reloadtime">';

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"> Set Height <input type="text" name="setheight" value="344">
</tr>
<tr>
<td align="center" valign="center"><input type="submit" name="action" value="Submit"></td>
</tr>
</form
</table>




 

 

 

 

Link to comment
Share on other sites

<?php
if(!isset($_POST['action'])){
     $_POST['action'] = '';
}

if($_POST['action'] == 'Submit') {
   
$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'];
$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 '<meta http-equiv="refresh" content="$reloadtime">';

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"> Set Height <input type="text" name="setheight" value="344">
</tr>
<tr>
<td align="center" valign="center"><input type="submit" name="action" value="Submit"></td>
</tr>
</form
</table>

Link to comment
Share on other sites

thanks thorpe :D

 

How do i make a $variable be able to be place in between text like this

 

123.com/123$variable123.php

 

do i need to add

 

123.com/123.'$variable123'.php or something like that

 

Hard to tell from your example, so I'll give a you a few examples.

 

$var = 'foo';

echo "this is $var bar";
echo "this is " . $var . " bar";
echo 'this is ' . $var . ' bar';

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.