PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
odie2828
Forum Commoner
Posts: 39 Joined: Tue Aug 05, 2008 4:40 pm
Post
by odie2828 » Fri Oct 24, 2008 11:48 am
I have a text field named imagedel
i want
$myfile = 'imagedel'
Code: Select all
<form name="form1" method="post" action="delete.php">
<p>Delete Image?</p>
<p>
<input name="imagedel" type="text" value="<?php echo $pic; ?>" size="25" />
</p>
<p>
<input type="submit" value="Delete" />
</p>
</form>
Code: Select all
<?php
$myfile = 'imagedel';
unlink($myfile);
?>
what is the proper coding for that?
odie2828
Forum Commoner
Posts: 39 Joined: Tue Aug 05, 2008 4:40 pm
Post
by odie2828 » Fri Oct 24, 2008 11:58 am
Or how can i have the unlink function use the file name that is in a text field to determine what file to delete?
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Fri Oct 24, 2008 12:10 pm
oscardog
Forum Contributor
Posts: 245 Joined: Thu Oct 23, 2008 4:43 pm
Post
by oscardog » Fri Oct 24, 2008 12:31 pm
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Fri Oct 24, 2008 12:32 pm
Do NOT just do something like unlink($_POST['myfile']); though. Validate it and make sure it's a file the user should be allowed to delete first.