How do you run a script in the same page?

  • Frostbyt3
  • Graduate
  • Graduate
  • User avatar
  • Posts: 221
  • Loc: Corpus Christi, TX

Post 3+ Months Ago

How do you run a script in the same page?

Example, I want a user to click a link and I want it to run a function to copy a file into a different directory. How would I do this without the user have a white blank page open called "copyfile.php"?

Is there a special trick to this?

Thank you
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Frostbyt3
  • Graduate
  • Graduate
  • User avatar
  • Posts: 221
  • Loc: Corpus Christi, TX

Post 3+ Months Ago

nevermind, I think I got it.

Code: [ Select ]
 
<?php
 
$sig = $_GET['img'];
 
if ($sig == "") {} else {
 
$file = 'images/'.$_GET['img'].'.jpg';
$newfile = 'images/sig.jpg';
 
copy("$file","$newfile");
 
echo "<h2>Sig Successfully Changed</h2>";
};
 
?>
  1.  
  2. <?php
  3.  
  4. $sig = $_GET['img'];
  5.  
  6. if ($sig == "") {} else {
  7.  
  8. $file = 'images/'.$_GET['img'].'.jpg';
  9. $newfile = 'images/sig.jpg';
  10.  
  11. copy("$file","$newfile");
  12.  
  13. echo "<h2>Sig Successfully Changed</h2>";
  14. };
  15.  
  16. ?>


I guess that's it. If there's any other way that would make more sense then please let me know. I'm still kind of a beginner at php :)

thanks guys :)

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 70 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.