jnerotrix Posted January 23, 2009 Share Posted January 23, 2009 Here is the error i get: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /www/rack111.com/p/o/p/popcornpetz/htdocs/index.php on line 21 In this code <?php include('header.php'); ?> <title> View it </title> <center> <?php if (isset($_POST['action'])) { session_start(); $_SESSION['numtimes'] = (isset($_POST['times']) && is_numeric($_POST['times']))?$_POST['times']:10; $_SESSION['url'] = $_POST['url']; $_SESSION['reload'] = $_POST['reloadtime']; $_SESSION['w'] = $_POST['setwidth']; $_SESSION['h'] = $_POST['setheight']; $autoplay = "&autoplay=1"; if ($HTTP_POST_VARS["submitted"] == "yes"){ echo "<meta http-equiv='refresh' content=/"$_SESSION['reload'];">"; } for ($i=0; $i < $_SESSION['numtimes']; $i++) { echo '<object width="' . $_SESSION['w']; . '" height="' . $_SESSION['h']; . '"><param name="movie" value="http://www.youtube.com/v/' . $_SESSION['url'] . '&hl=en&fs=1"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $_SESSION['url'] . '&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="' . $_SESSION['w'] . '" height="' . $_SESSION['h'] . '"></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=" size="30"><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"> <input type="hidden" name="submitted" value="yes"> </td> </tr> </form </table> Quote Link to comment https://forums.phpfreaks.com/topic/142064-parse-error-syntax-error-unexpected-t_variable-expecting-or-help/ Share on other sites More sharing options...
Maq Posted January 23, 2009 Share Posted January 23, 2009 Replace line 21 with this: echo ""; Quote Link to comment https://forums.phpfreaks.com/topic/142064-parse-error-syntax-error-unexpected-t_variable-expecting-or-help/#findComment-743982 Share on other sites More sharing options...
jnerotrix Posted January 23, 2009 Author Share Posted January 23, 2009 ok thats fixed but now i have a sessions problem i get this session error Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /www/rack111.com/p/o/p/popcornpetz/htdocs/header.php:7) in /www/rack111.com/p/o/p/popcornpetz/htdocs/index.php on line 11 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /www/rack111.com/p/o/p/popcornpetz/htdocs/header.php:7) in /www/rack111.com/p/o/p/popcornpetz/htdocs/index.php on line 11 and heres the page code <?php include('header.php'); ?> <title> View it </title> <center> <?php if (isset($_POST['action'])) { session_start(); $_SESSION['numtimes'] = (isset($_POST['times']) && is_numeric($_POST['times']))?$_POST['times']:10; $_SESSION['url'] = $_POST['url']; $_SESSION['reload'] = $_POST['reloadtime']; $_SESSION['w'] = $_POST['setwidth']; $_SESSION['h'] = $_POST['setheight']; $autoplay = "&autoplay=1"; if ($HTTP_POST_VARS["submitted"] == "yes"){ echo "<meta http-equiv='refresh' content='{$_SESSION['reload']}'>"; } for ($i=0; $i < $_SESSION['numtimes']; $i++) { echo "<object width='{$_SESSION['w']}' height='{$_SESSION['h']}'><param name='movie' value='http://www.youtube.com/v/{$_SESSION['url']}&hl=en&fs=1'></param><param name='allowFullScreen' value='false'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/{$_SESSION['url']}&hl=en&fs=1$autoplay' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='false' width='{$_SESSION['w']}' height='{$_SESSION['h']}'></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=" size="30"><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"> <input type="hidden" name="submitted" value="yes"> </td> </tr> </form </table> Quote Link to comment https://forums.phpfreaks.com/topic/142064-parse-error-syntax-error-unexpected-t_variable-expecting-or-help/#findComment-743986 Share on other sites More sharing options...
aeonsky Posted January 23, 2009 Share Posted January 23, 2009 Put session_start(); at the top of the page. Quote Link to comment https://forums.phpfreaks.com/topic/142064-parse-error-syntax-error-unexpected-t_variable-expecting-or-help/#findComment-744004 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.