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.
Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    New Coder
    Join Date
    Mar 2013
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Sorry ignore above post

    I put this into the contact page its self it now doesn't appear to send a email and hasn't checked for field's to be valid before sending

  2. #17
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by Robmarks View Post
    It doesn't seem to do work like it just bypasses the error coding and i still get the same


    Warning: Invalid argument supplied for foreach() in /home/philipma/public_html/process.php on line 23

    Warning: Cannot modify header information - headers already sent by (output started at /home/philipma/public_html/process.php:23) in /home/philipma/public_html/process.php on line 49
    Remove the errors line

    PHP Code:
    //$errors = ''; 
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  3. #18
    New Coder
    Join Date
    Mar 2013
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Removed the errors line, however still get this below and still able to send blank messages to myself

    Warning: Cannot modify header information - headers already sent by (output started at /home/philipma/public_html/contact.php:112) in /home/philipma/public_html/contact.php on line 132

  4. #19
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    sounds like you have something echoing out on line 112
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  5. #20
    New Coder
    Join Date
    Mar 2013
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Line 112 is my opening php bracket and line 132 is my header

    PHP Code:
    header('Location: contact.php'); 

  6. #21
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    this script needs to go at the top of the page
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  7. #22
    New Coder
    Join Date
    Mar 2013
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts
    This is a nightmare still able to send blanks

  8. #23
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    i've seen problems with forms sending blank fields.

    you just need to alter the script slightly

    add a hidden field to see if the form is posted

    Code:
    <input type="hidden" name="formsent" value="Sent" />
    and try this at the top instead:

    PHP Code:
    if (isset($_POST['formsent']) && $_POST['formsent'] == "Sent"){
    if (!isset(
    $_POST['email']) || strlen($_POST['email'])<1){ $errors[] = "Email Field is Required. <BR>";}
    if (!isset(
    $_POST['movingto']) || strlen($_POST['movingto'])<1){ $errors[] = "Moving to is Required. <BR>";}
    if (!isset(
    $_POST['movingfrom']) || strlen($_POST['movingfrom'])<1){ $errors[] = "Moving from is Required. <BR>";}
    if (!isset(
    $_POST['message']) || strlen($_POST['message'])<1){ $errors[] = "Message is Required. <BR>";}


    if (
    count($errors) == 0){
       
    $to 'robmarks1994@aol.co.uk' 
       
       
    $subject 'Customer'
       
    $headers  'MIME-Version: 1.0' "\r\n";
       
    $headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
       
    $message "<table><tr><td>Your Name</td><td>".$_POST['name']."</td></tr>
                   <tr><td>E-Mail</td><td>"
    .$_POST['email']."</td></tr>
                   <tr><td>Moving to</td><td>"
    .$_POST['movingto']."</td></tr>
                   <tr><td>Moving from</td><td>"
    .$_POST['movingfrom']."</td></tr>
                   <tr><td>Message</td><td>"
    .$_POST['message']."</td>
                   </tr></table>" 
    ;
       
    mail($to$subject$message$headers);
       
    header('Location: contact.php'); 
    }else{
    foreach( 
    $errors as $error){ 
    echo 
    $error;
    }
    }
    }
    ?> 
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  9. Users who have thanked Arcticwarrio for this post:

    Robmarks (03-20-2013)

  10. #24
    New Coder
    Join Date
    Mar 2013
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Its works!!!! Thanks for the help through out this it, is it alright if i pm you if i ever have more problems

    Rob


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

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