how to use session in second page as a directory name in php -


<?php $videopath = 'video/$_session['username']'; $videoexts = array('webm'=>'video/webm','mp4'=>'video/mp4','mpeg'=>'video/mp4','ogv'=>'video/ogv'); $directory = "/video"; $phpfiles = glob($directory . "*.html");  if ($handle = opendir($videopath)) { while (false !== ($file = readdir($handle))) {     $info =pathinfo($file);    $ext = strtolower($info['extension']);    $filename = basename($file,".$ext");       if (array_key_exists($ext, $videoexts)) {       ?> 

i taking $_session['username'] log in page

$_session['username'] = $username; 

i creating folder name

mkdir("video/$username"); 

but code give error this

parse error: syntax error, unexpected 'username' (t_string) in c:\xampp\htdocs\akash\vidsite\mychannel.php on line 38

please how use session

$videopath = 'video/$_session['username']';

has be

$videopath = 'video/' . $_session['username']; 

or

$videopath = "video/{$_session['username']}"; 

because you're breaking quotes in string.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -