Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New Coder
    Join Date
    Nov 2010
    Posts
    15
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Another php form problem!! Contact form not delivering to specified email address....

    Hi guys, new member, nice to meet u all!!! please can someone help me?!?!

    id love Someone to look through my code, as i cannot for the life of me work out how to make this form deliver an email to an address!!!!

    the unfinished site is here: http://www.qubicsolutions.co.cc

    I have trawled through the forum, trying to find a solution to this problem (many reported) and cant find one to work for me...

    each are content specific, i have a contact form on a site i am in the process of building.

    Everything seems to work, but the email never arrives at the specified email address after the form...

    Ive tried everything!!!!!!!!!

    im not sure if its to do with 000webhost, or my domain or simply wrong coding

    If someone could help me before i lob my macbook out the window,

    thanks guys, much appreciated!!!!!

    PHP Code:
    <?php

    $emailSubject 
    'qubiccontactform!'
    $webMaster 'twistedbreakz@yahoo.co.uk';


    $name $_POST['name'];
    $email $_POST['email'];
    $subject $_POST['subject'];
    $comments $_POST['comments'];


    $body = <<<EOD
    <br><hr><br>
    Name: $name <br>
    Email: $email <br>
    Subject: $subject <br>
    Comments: $comments <br>
    EOD;
    $headers "From: $email\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success mail($webMaster$emailSubject$body,
    $headers);



    $theResults = <<<EOD
    <html>
    <head>
    <title>sent message</title>
    <meta http-equiv="refresh" content="3;URL=http://www.qubicsolutions.co.cc">
    <style type="text/css">
    <!--
    body {
    background-color: #999;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 20px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    color: #fec001;
    text-decoration: none;
    padding-top: 200px;
    margin-left: 150px;
    width: 800px;
    }
    -->
    </style>
    </head>
    <div align="center">Thank you for your enquiry to Qubic Web Solutions, we will respond to your question as soon as possible</div>
    </div>
    </body>
    </html>
    EOD;
    echo 
    "$theResults";
    ?>


    AND THE FORM CODE IS....

    <form name="form1" method="post" action="qubiccontactform.php">
              <br>
              <br>
              <br>
              <br><br><br><br><br><br><br><br><label>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name:<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="name" id="name">
              </label>
              <label><br>
              <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EMail:<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="email" id="email">
              </label>
              <label><br>
              <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Subject:<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="subject" id="subject">
              </label>
              
            
            
              <label><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Comments & Questions:<br>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<textarea name="comments" id="comments" cols="45" rows="3"></textarea>
              </label>
              
            </form>




    <form name="form1" method="post" action="qubiccontactform.php">
            <input type="image" src="images/images/send_it.jpg" width="101" height="31" name="submit" id="submit" value="Submit">
          </form>

    The submit button is a custom button seperate to the form instance, im not sure if this is where my problem lies, but i have inserted a submit button into the form to test and no email is sent still!!

    If someone could take a look at this i would be propa chuffed, as its doin my head in!!!

  • #2
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    check your headers, try
    PHP Code:
    $headers "From: $email"."\r\n";
    $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"

  • Users who have thanked poyzn for this post:

    FUZ10N (11-09-2010)

  • #3
    New Coder
    Join Date
    Nov 2010
    Posts
    15
    Thanks
    8
    Thanked 0 Times in 0 Posts
    will try it now,

    thanks for the quick reply!!

    i will let you know the results

  • #4
    New Coder
    Join Date
    Nov 2010
    Posts
    15
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Thumbs up

    ledgend!!

    i recieved the mail,

    just with no content!!!!

    any ideas!?

  • #5
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    check your encoding in the header and try to replace the $body variable in the mail function with some string, 'test' for example
    Last edited by poyzn; 11-09-2010 at 07:39 PM.

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    If you echo $body, does it look right?

  • Users who have thanked Keleth for this post:

    FUZ10N (11-09-2010)

  • #7
    New Coder
    Join Date
    Nov 2010
    Posts
    15
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Thanks guys, you have no idea how much i appreciate this

    EOT didnt work....

    will try echo $body, without sounding think, how exactly can i tie this in??

  • #8
    New Coder
    Join Date
    Nov 2010
    Posts
    15
    Thanks
    8
    Thanked 0 Times in 0 Posts
    i see, to use as a test... makes sense!!! and no still no content, just headings!!!

  • #9
    New Coder
    Join Date
    Nov 2010
    Posts
    15
    Thanks
    8
    Thanked 0 Times in 0 Posts
    ok,

    i can see the problem now with the content.

    its to do with the seperate submit button.

    i have inserted a standard submit button within the form and it has worked...

    any ideas now?!?! i dont want to use the horrible standard submit buttons. if you take the link to the site you will see what i mean...

  • #10
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    something wrong with your heredoc syntax, I've copypasted it and have had to rewrite ";" symbol
    also you can check for a right new lines

  • Users who have thanked poyzn for this post:

    FUZ10N (11-09-2010)

  • #11
    New Coder
    Join Date
    Nov 2010
    Posts
    15
    Thanks
    8
    Thanked 0 Times in 0 Posts
    all sorted, it was to do with my form tags...

    thanks for your help with the headers, it is now sending me mail, albeit into my junk folder but sending with content nonetheless!!!

    cheers guys.

  • #12
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,340
    Thanks
    13
    Thanked 349 Times in 345 Posts
    an image submit button:
    PHP Code:
    <button name="submit" id="submit">
        <
    img src="images/images/send_it.jpg" width="101" height="31" alt="submit">
    </
    button
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • Users who have thanked Dormilich for this post:

    FUZ10N (11-09-2010)


  •  

    Posting Permissions

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