Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1

    Default Submit Button on a form

    Hi there i've got the following code
    HTML Code:
    <input type="submit" name="button" id="button" value="Submit" />
    what do i need to add to make it send to an e-mail address?

    Moved by Meti (Forum Moderator) from Designing and Development: Please post in the correct forum next time, thanks .
    Last edited by Meti; 22-11-2008 at 10:10 PM.

  2. #2
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by TuckJump View Post
    Hi there i've got the following code
    HTML Code:
    <input type="submit" name="button" id="button" value="Submit" />
    what do i need to add to make it send to an e-mail address?

    Moved by Meti (Forum Moderator) from Designing and Development: Im a noob.
    You need to point it to a page that handles the mail. Preferably the mail() function in php

    Look up mail();

  3. #3
    Join Date
    Sep 2007
    Posts
    220
    Tokens
    175

    Default

    <input method="post" action="mailto:[email protected]" enctype="text/plain">

    I "THINK" that will work. Unsure.
    Kindest Regards,
    -- Brad







    [People Will Bow To Me]

  4. #4
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    2,015
    Tokens
    568

    Latest Awards:

    Default

    Quote Originally Posted by Tylenol View Post
    <input method="post" action="mailto:[email protected]" enctype="text/plain">

    I "THINK" that will work. Unsure.
    No, it won't.

  5. #5
    Join Date
    Sep 2007
    Posts
    220
    Tokens
    175

    Default

    I appologize.
    Kindest Regards,
    -- Brad







    [People Will Bow To Me]

  6. #6
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php

        
    if( ! $_POST'submit' ] ) { 
            echo 
    '<form action="" method="post">
            
            Email to send to:<br /><input type="text" name="email" /><br />
            Message:<br /><textarea rows="2" cols="20" name="message"></textarea><br />
            <input type="submit" name="button" id="button" value="Submit" />
            
            </form>'
    ;
            
        } else { 
        
            
    $headers .= 'To: Me <[email protected]>' "\r\n";
            
    $headers .= 'From: Contact Email form thing! <[email protected]>' "\r\n";
            
            
    $subject 'Couldn\'t be bothered to make another field, email from a contact form!';
            
            
    $to $_POST'email' ];
            
    $message $_POST'message' ];    
            
            
    mail($to$subject$message$headers);
        
        }
    ?>
    That should work, change both of the headers to the emails that you wish to send to/from.

  7. #7

    Default

    Is there a more simpler one I'm using HTML really not PHP I've been shown a simpler one but can't remember it... But thanks for all the help!

  8. #8
    Join Date
    Sep 2008
    Posts
    718
    Tokens
    0

    Default

    Quote Originally Posted by Calon View Post
    PHP Code:
    <?php

        
    if( ! $_POST'submit' ] ) { 
            echo 
    '<form action="" method="post">
            
            Email to send to:<br /><input type="text" name="email" /><br />
            Message:<br /><textarea rows="2" cols="20" name="message"></textarea><br />
            <input type="submit" name="button" id="button" value="Submit" />
            
            </form>'
    ;
            
        } else { 
        
            
    $headers .= 'To: Me <[email protected]>' "\r\n";
            
    $headers .= 'From: Contact Email form thing! <[email protected]>' "\r\n";
            
            
    $subject 'Couldn\'t be bothered to make another field, email from a contact form!';
            
            
    $to $_POST'email' ];
            
    $message $_POST'message' ];    
            
            
    mail($to$subject$message$headers);
        
        }
    ?>
    That should work, change both of the headers to the emails that you wish to send to/from.
    How would you send that to more than 1 person?
    +.net - omg it's coming o_o

  9. #9
    Join Date
    Sep 2008
    Location
    UK
    Posts
    3,670
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by HabbDance View Post
    How would you send that to more than 1 person?
    I wouldn't advise making a bomber
    Back for a while.

  10. #10

    Default

    Not the best at this but er;

    PHP Code:
    <?php

        
    if( ! $_POST'submit' ] ) { 
            echo 
    '<form action="" method="post">
            
            Email to send to:<br /><input type="text" name="email" /><br />
            Message:<br /><textarea rows="2" cols="20" name="message"></textarea><br />
            <input type="submit" name="button" id="button" value="Submit" />
            
            </form>'
    ;
            
        } else { 
        
            
    $headers .= 'To: Me <[email protected]>' "\r\n";
            
    $headers .= 'From: Contact Email form thing! <[email protected]>' "\r\n";
            
            
    $subject 'Couldn\'t be bothered to make another field, email from a contact form!';
            
            
    $to $_POST'email' ];
            
    $message $_POST'message' ];    
            
            
    mail($to$subject$message$headers);
            
    mail(whereyouwanttomail@heaven.com$subject$message$headers);
        
        }
    ?>
    That would probably work, there's obviously other ways of doing it, it depends what exactly you want to do.

    Or you could even add more form spaces;

    PHP Code:
    <?php

        
    if( ! $_POST'submit' ] ) { 
            echo 
    '<form action="" method="post">
            
            Email to send to:<br /><input type="text" name="email" /><br />
            Second Email to send to:<br /><input type="text" name ="email2" /><br />
            Message:<br /><textarea rows="2" cols="20" name="message"></textarea><br />
            <input type="submit" name="button" id="button" value="Submit" />
            
            </form>'
    ;
            
        } else { 
        
            
    $headers .= 'To: Me <[email protected]>' "\r\n";
            
    $headers .= 'From: Contact Email form thing! <[email protected]>' "\r\n";
            
            
    $subject 'Couldn\'t be bothered to make another field, email from a contact form!';
            
            
    $to $_POST'email' ];
            
    $toalt $_POST['email2'];
            
    $message $_POST'message' ];    
            
            
    mail($to$subject$message$headers);
            
    mail($toalt$subject$message$headers);
        
        }
    ?>
    Last edited by Jam-ez; 24-11-2008 at 08:42 PM.

Page 1 of 2 12 LastLast

Posting Permissions

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