Results 1 to 3 of 3

Thread: FIXED: Would like to mail on submit button

  1. #1
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default FIXED: Would like to mail on submit button

    I have a PHP page that users can upload an image to the site. I wanted to get an email everytime a user uploads an image so I added ;

    PHP Code:
    mail('myemail@host.com''New Uploaded Feature Image''a user has uploaded an image to be reviewed for a featured image. 
    Which is all fine and dandy but now everytime the page loads I get an email. What I would like to is see if I can add it to the value section of my upload button.

    Code:
    <input name="Submit" type="submit" value="Upload Image">
    Can I add the mail function to something like this?

    Code:
    <input name="Submit" type="submit" value="Upload Image", "<?php mail('myemail@host.com', 'New Uploaded Feature Image', 'a user has uploaded an image to be reviewed for a featured image.?> ">
    Last edited by Dirt_Diver; 08-25-2008 at 05:08 PM.

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    you need to further elaborate on your code . try something like this :

    Code:
    <?php
    
    if(isset($_POST['MY_FILE_UPLOAD'])) {
    
    mail('myemail@host.com', 'New Uploaded Feature Image', 'a user has uploaded an image to be reviewed for a featured image. ');
    
    }
    
    ?>
    you need to put this mail function where the code calls the page once it's submitted.

    good luck
    - Josh

  3. #3
    Join Date
    Aug 2008
    Location
    Smiths, AL
    Posts
    164
    Thanks
    30
    Thanked 5 Times in 5 Posts

    Default

    Hey thanks I got it, I saw that my error was where I had it located.

    Here is the code

    PHP Code:
    if(isset($_POST['Submit']) && !$errors)
    {

    echo 
    "<center><h2>Test goes here</h2></center>";
    echo 
    '<a href="'.$newname.'"rel="lightbox" title="<center><strong>Your Submission Image</strong></center>"> <img src="'.$thumb_name.'"></a>';
    mail('email@host.com''Subject''content. ');

    Last edited by Dirt_Diver; 08-25-2008 at 05:08 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •