Jump to content

[SOLVED] Two actions on form submit


btr2007

Recommended Posts

Is there anyway for a form to have two actions?

 

Example:

Visitor selects a file to upload and when they click upload it calls the upload script and also sends an email to a recipient using a form-to-mail script.

 

Or is there some code that can be included in the upload script to send an email?

Link to comment
Share on other sites

Will that still work when I'm using that Formmail script to send the email?

 

<?php
// Where the file is going to be placed 
$var1 = $_GET["leadon"];
//$path = mysql_real_escape_string('leadon');
$target_path = $var1;

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file " .  basename( $_FILES['uploadedfile']['name']) . 
    " has been uploaded";
   /*Add email code here? - can it be a call to formmail or could i use some other script?*/

} else{
echo $target_path;
    echo "There was an error uploading the file, please try again!";
}
?>

Link to comment
Share on other sites

Ok I've decided to use some php code to send the email instead.

 

The script i was using is in a pl file and gets stored in the bin.

 

If i can get the php email code to work i will mark this topic as solved but if i don't i will use this topic for questions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.