开发者

Creating a Directory with MkDir then appending the Folder to a Html doc?

开发者 https://www.devze.com 2023-03-30 12:09 出处:网络
I have an A-Z list of users, and I\'d like to be able to append the new folders created with mkdir() instead of manually adding them to the .html page. Just attached an example

I have an A-Z list of users, and I'd like to be able to append the new folders created with mkdir() instead of manually adding them to the .html page. Just attached an example

Eg:

UserList.html
Example user:
<a href="Obama/"><font size="4" color="yellow">Barrack Obama</a>

Mkdir Form:

<form action="Create.php" method="post">
Full Name: <input type="text" name=开发者_如何学Go"Username" /><br />
<input type="submit" value="Create User Folder"/>
</form>

Create.php
<?php
mkdir($_POST["UserName"], 0777);
?>


NB: Suggest making these folders in a different directory then your root directory, maybe users/obama

You could use a function called readdir() which will read the contents of the directory ready for output.

http://au.php.net/readdir

Here is a link to some information about reading dir's in php

http://www.dreamincode.net/forums/topic/13426-list-of-folders/page_view_findpost_p_134369


have another request that returns all the folders in the user directory and put them on the page. i.e create the link html in php as well. you could use ajax if you want to do this without reloading the page.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号