I use this code as reference. I won't paste the link where I got this since I am not sure if it is okay to paste external sites. PHP Code: <?php $files = glob("images/*.*");
Use PHP Variable as Button Name Issue
2
I use this code as reference. I won't paste the link where I got this since I am not sure if it is okay to paste external sites.
Here's what I have. I need a button that will delete specific file. The code works but sometimes it deletes the wrong file.
Note: ob_start( ) is placed at the start of the page for the header to work.
Please need help on this. I just started on this php thing last month so I am really a newbie on this. Any help would be awesome.
Relax: watch pete's dragon | watch bad moms | watch suicide squad
PHP Code:
<?php $files = glob("images/*.*");
for ($i=1; $i<count($files); $i++) {
$num = $files[$i];
print $num."<br />";
echo '<img src="'.$num.'" alt="random image" />'."<br /><br />";
}
?> Note: ob_start( ) is placed at the start of the page for the header to work.
PHP Code:
<?php
$files = glob("folder1/*.jpg*");
array_multisort(
array_map( 'filemtime', $files ),
SORT_NUMERIC,
SORT_DESC,
$files
);
for ($i=0; $i<count($files); $i++)
{
$image = $files[$i];
echo " <div class=\"boxout\">\n";
echo " <div class=\"label\">\n";
print basename($image);
echo " </div>\n";?>
<div class="label">
<form><input type="submit" name="select<?php echo $i;?>" value="Move" id="backup" class="backup"/></form>
</div>
<?php if(isset($_GET["select".$i]) ) {
file_put_contents('backup.txt', "This is ".basename($image, ".jpg").chr(32).chr(34)."Some
strings.".chr(34)."\n", FILE_APPEND | LOCK_EX);
rename($image,"folder1/images/page1_".basename($image));
unlink($image);
ob_end_clean( );
header("Location: Page1.php");
} Relax: watch pete's dragon | watch bad moms | watch suicide squad
- Julien Fletcher
- sunsetcoder
- David Beroff
Next Topics on Trending Feed
-
2