I know, I know, I'm new here, but I really need help with this. The more I learn, the more I can help others, right? ^^;
<?php
$username = 'timmy';
$pathname = '/profiles/' , $username;
$mode = '0777';
?>
<html>
<head>
<title>Test</title>
</head>
<body>
<input type="button" value="Make Directory" onClick="<?php mkdir($pathname, $mode, true)?>">
</body>
</html>
Why won't this work? Gives me an error.
I know it's not that I'm using the PHP code inside the onClick="" parameter, because it works if I don't use the string
$pathname in place of "/profiles/username/" -- however, this will not allow me to make a dir of the user's username (hence
$username).
I'll explain what I'm trying to do.
I am slowly but surely learning PHP, so in this struggle I wish to apply the ever-growing knowledge to building a social network for role players.
I won't go into what role players are, if you know that's awesome but it's irrelevant.
This bit of code is supposed to take the username, and create a sub-directory inside the folder "profiles/", and this sub-directory should be the username of the person clicking the button.
As for now, I am using 'timmy' as an example username, and I got the mkdir() function to work fine. However, I cannot get the mkdir() function to include the string "$username" in the string "$pathname", or to do anything with strings
at all.
In other words, I want the user to create a new folder inside the already-existing folder "profiles/", which will be named the same as the string "$username", which is, for this example, "timmy". Hence,
$username = 'timmy';
.
Any help would be greatly appreciated ^^ Even if you don't help, a reply will keep the post alive for someone who knows more than Id o about what they're doing to lend a hand! =D