I am passing variables from a button into a myFunction. I can create an alert box showing the correct information but when I use these variables in a copy command it does nothing. My goal is to display images in a directory. The user can click on the button with that image in it and have it copy the image file from the /storage/ directory to the /attach/ directory. Can anyone help me with this please....Thanks
My complete file i've created is:
<!DOCTYPE html>
<html>
<head>
<title>Mark Nutt</title>
<script>
function myFunction(greeting,greeting2,source,destination)
{
<?php
echo copy('"+source+"','"+destination+"');
?>
alert("copy('"+source+"','"+destination+"')");
alert(greeting2 +' attached to email!');
}
</script>
</head>
<body>
<a href="#" onclick="MyWindow=window.open('http://www.davidsdomaindesign.com/marknutt/emails/emails.php','_self'); return true;"><font size="2" color="white"><input type="button" value="I'm Done" /></font></a><br />
<?php
$files = glob("/home/davidsdo/public_html/marknutt/photos/storage/*.jpg");
asort($files);
for ($i=0; $i<count($files); $i++)
{$num = $files[$i];
$file = substr($num,51);
?>
<button onclick="myFunction('<?php echo $file ?>','<?php echo substr_replace($file,"",-4); ?>','<?php echo $source='/home/davidsdo/public_html/marknutt/photos/storage/'; echo $file; ?>','<?php echo $destination='/home/davidsdo/public_html/marknutt/emails/attach/'; echo $file; ?>')" >
<input type="button" value="<?php echo substr_replace($file,"",-4); ?>" /><br /><img src="http://www.davidsdomaindesign.com/marknutt/photos/storage/<?php echo $file ?>" alt="<?php echo $file ?>" width="125" height="125">
</button>
<?php
}
?>
</body>
</html>