SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    form submit blank email on page load

    i am working on a form that uses a mail() function to email, but when the page is clicked, it send a blank email. how can i stop it until submit button is clicked?
    All those who wander aren't lost.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Check if the form has been sent.

  3. #3
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    how?
    All those who wander aren't lost.

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    PHP Code:
    if (isset($_POST['formfieldname'])) {  


    Assuming that your form's method='post'. If it's 'get', then use $_GET['formfieldname']

  5. #5
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    right now i am using
    Code PHP:
    if(isset($_POST['submit'])){
     
    }
    within those curly bracket i m settling the field name into variable. so wht should i do to change it?
    All those who wander aren't lost.

  6. #6
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Can you post the entire script (without database login data)?

  7. #7
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    here it is
    Code PHP:
    <?php
    if(isset($_POST['submit'])){
    $refBy = "<p>"."Refered By :" .$_POST['referrer']."</p>";
    $comp = "<p>"."Company  :" .$_POST['company']."</p>";
     if(isset($_POST['checko'])){
             $opt = implode("<br>",$_POST['checko']);
         }else{
            echo ""; 
         }
    }
    if(isset($_POST['payment']))
        {
            $payMod = implode("<br>", $_POST['payment']);
        }
     
    ?>
    All those who wander aren't lost.

  8. #8
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    You'll have to put the mail() command inside that if as well. You want to send a mail only when the form has been submitted.


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
  •