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 7 of 7
  1. #1
    New Coder
    Join Date
    Sep 2009
    Posts
    51
    Thanks
    29
    Thanked 0 Times in 0 Posts

    PLEASE HELP... with my email script

    So far I have what is below, it sends and replies to emails like it is supposed to however I can not get it to show error messages in the area provided...

    It seems not to show the error messages of confirmation...

    if it is of help give it a go at www.erbimages.com/contact.php

    just use demo demo demo etc in the fields...

    PLEASE HELP... heres the script...

    PHP Code:
     <?php
    if(isset($_POST['send'])){
    $to $_REQUEST['sendto'] ; // change all the following to $_POST
    $from $_REQUEST['Email'] ;
    $name $_REQUEST['Name'] ;
    $headers "From: $from";
    $subject "Web Contact Data";

    $fields = array();
    $fields{"Name"} = "Name";
    $fields{"Company"} = "Company";
    $fields{"Email"} = "Email";
    $fields{"Message"} = "Message";

    $body "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

    $headers2 "From: noreply@erbimages.com";
    $subject2 "Thank you for contacting us.";
    $autoreply "Thank you for contacting us. Somebody will get back to you as soon as possible, usually within 48 hours.";
        
    $send=false;
        if(
    $from == '') {$error"You have not entered an email, please go back and try again";}
        else {
        if(
    $name == '') {$error"You have not entered a name, please go back and try again";}
        else {
        
    $send mail($to$subject$body$headers);
        
    $send2 mail($from$subject2$autoreply$headers2);
        }
        if(!isset(
    $error) && !$send)
            
    $error"We encountered an error sending your mail, please notify service@erbimages.com"; }
    }
    // end of if(isset($_POST['send']))
    ?>

    <?php include("http://www.erbimages.com/php/head.php"); ?>
    <?php 
    include("http://www.erbimages.com/php/start.php"); ?>
    <?php 
    include("http://www.erbimages.com/php/topline/return.php"); ?>

                <div class="section_right">
                    <ul id="section_contact">
                        <li>
                            <span id="section_header_right_contact">CONTACT</span>
                        </li>
                        <li>
                            <span id="section_txt">
                            
                            <?php
                            
    if(isset($error))
                                echo 
    '<span id="section_error">'.$error.'</span>';
                            if(isset(
    $send) &&  $send== true){
                                echo 
    'Your message has been send. Thank you.';
                            }
                            if(!isset(
    $_POST['send']) || isset($error))
                            
    ?>
                               
                            <form method="post" action="contact.php">
                            <p>Your Details</p>
                            <p><select name="sendto"><option value="info@erbimages.com">Information</option> <option value="hire@erbimages.com">Hire</option> <option value="rf@erbimages.com">Royalty Free</option> <option value="service@erbimages.com">Technical</option></select></p>
                            <p><font color=red>*</font> <font style="padding-right: 2em;">Name:</font><input size=25 name="Name"></p>
                            <p><font color=red>*</font> <font style="padding-right: 2em;">Email:</font><input size=25 name="Email"></p>
                            <p><font style="padding-right: 2em;">Company / Event:</font><input size=25 name="Company"></p>
                            <p>Message</p>
                            <p><textarea name="Message" rows=5 cols=35></textarea></p>
                            <p><input type=submit name="send" value="Submit"></p>
                            </form> 
                            </span>
                        </li>
                    </ul>
                </div>

    <?php include("http://www.erbimages.com/php/quiet_footer.php"); ?>
    <?php 
    include("http://www.erbimages.com/php/end.php"); ?>

    PLEASE HELP, I REALLY NEED YOU...

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Try some debugging. You can do some quick but ugly debugging with die(). I'd start here:
    PHP Code:
    if(isset($_POST['send'])){ 
    die(
    "I'm here"); 
    That will confirm you're actually entering the area for the assignments and tests. If that shows up, move the die() to another block a little later and test if control is going through there. When it stops dying, you've found the problem area.
    Are you a Help Vampire?

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Hmm you should probably change this
    PHP Code:
        if(!isset($error) && !$send
    to this
    PHP Code:
        if($error == '' && !$send
    Then at the top of your code add $error = '';

    Then change this
    PHP Code:
    if(isset($error))
                                echo 
    '<span id="section_error">'.$error.'</span>'
    to this
    PHP Code:
    if($error != '')
                                echo 
    '<span id="section_error">'.$error.'</span>'
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    lozbenson (10-31-2009)

  • #4
    New Coder
    Join Date
    Sep 2009
    Posts
    51
    Thanks
    29
    Thanked 0 Times in 0 Posts
    Have done...

    So now it reads

    PHP Code:
    <?php
    if(isset($_POST['send'])){
    $to $_REQUEST['sendto'] ; // change all the following to $_POST
    $from $_REQUEST['Email'] ;
    $name $_REQUEST['Name'] ;
    $headers "From: $from";
    $subject "Web Contact Data";

    $fields = array();
    $fields{"Name"} = "Name";
    $fields{"Company"} = "Company";
    $fields{"Email"} = "Email";
    $fields{"Message"} = "Message";

    $body "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

    $headers2 "From: noreply@erbimages.com";
    $subject2 "Thank you for contacting us.";
    $autoreply "Thank you for contacting us. Somebody will get back to you as soon as possible, usually within 48 hours.";
        
    $send=false;
        if(
    $from == '') {$error"You have not entered an email, please go back and try again";}
        else {
        if(
    $name == '') {$error"You have not entered a name, please go back and try again";}
        else {
        
    $send mail($to$subject$body$headers);
        
    $send2 mail($from$subject2$autoreply$headers2);
        }
        if(
    $error == '' && !$send)  
            
    $error"We encountered an error sending your mail, please notify service@erbimages.com"; }
    }
    // end of if(isset($_POST['send']))
    ?>

    <?php include("http://www.erbimages.com/php/head.php"); ?>
    <?php 
    include("http://www.erbimages.com/php/start.php"); ?>
    <?php 
    include("http://www.erbimages.com/php/topline/return.php"); ?>

                <div class="section_right">
                    <ul id="section_contact">
                        <li>
                            <span id="section_header_right_contact">CONTACT</span>
                        </li>
                        <li>
                            <span id="section_txt">
                            
                            <?php
                            
    if($error != '')
                                echo 
    '<span id="section_error">'.$error.'</span>'
                            if(isset(
    $send) &&  $send== true){
                                echo 
    'Your message has been send. Thank you.';
                            }
                            if(!isset(
    $_POST['send']) || isset($error))
                            
    ?>
                               
                            <form method="post" action="contact.php">
                            <p>Your Details</p>
                            <p><select name="sendto"><option value="info@erbimages.com">Information</option> <option value="hire@erbimages.com">Hire</option> <option value="rf@erbimages.com">Royalty Free</option> <option value="service@erbimages.com">Technical</option></select></p>
                            <p><font color=red>*</font> <font style="padding-right: 2em;">Name:</font><input size=25 name="Name"></p>
                            <p><font color=red>*</font> <font style="padding-right: 2em;">Email:</font><input size=25 name="Email"></p>
                            <p><font style="padding-right: 2em;">Company / Event:</font><input size=25 name="Company"></p>
                            <p>Message</p>
                            <p><textarea name="Message" rows=5 cols=35></textarea></p>
                            <p><input type=submit name="send" value="Submit"></p>
                            </form> 
                            </span>
                        </li>
                    </ul>
                </div>

    <?php include("http://www.erbimages.com/php/quiet_footer.php"); ?>
    <?php 
    include("http://www.erbimages.com/php/end.php"); ?>
    Unfortunately it still doesn't work...

    Any other ideas?

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You missed a step read it again. Change this
    PHP Code:
    <?php
                            
    if($error != '')
                                echo 
    '<span id="section_error">'.$error.'</span>';
    to this
    PHP Code:
    <?php
    echo $error;
                            if(
    $error != '')
                                echo 
    '<span id="section_error">'.$error.'</span>';
    and mess up on the form on purpose. Do you get any php errors?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    lozbenson (10-31-2009)

  • #6
    New Coder
    Join Date
    Sep 2009
    Posts
    51
    Thanks
    29
    Thanked 0 Times in 0 Posts
    Have change...

    No I dont get any errors, it was working fine before but it started not to show up the error messages, that is the only reason it doesnt work...

    Any clues?

  • #7
    New Coder
    Join Date
    Sep 2009
    Posts
    51
    Thanks
    29
    Thanked 0 Times in 0 Posts
    Got it working now, thanks


  •  

    Posting Permissions

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