Results 1 to 5 of 5

Thread: Text doesn't echo..

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    7

    Text doesn't echo..

    PHP Code:
    <?
    if($word_ok!==false)
    {
        if($word_ok=="yes")
        {

    $to=$_POST['to'];
    $subject=$_POST['subject'];
    $body=$_POST['body'];
    $from=$_POST['from'];
    $headers = "From: $from" . "\r\n" .
        'MIME-Version: 1.0' . "\r\n" .
        'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

    //mail($to,$subject,$body,$headers);

        if (@mail ($to, $subject, $body, $headers)) {

    echo "Email successfully sent to $to.";
    echo "<Br>Click <a href='mail.php'>here</a> to send another.<br />";
        } else {
    echo "Error sending email!";
    }
        } else {
            echo "The word you entered for the image verification did not match what was displayed.<br />"; 
        }
    }
    ?>
    Thats part of my email script, when I click the submit button none of that echos on the page, is there anything wrong with this script?

    If you want rest of the script then I'm using freeCap PHP CAPTCHA Version 1.4.1
    Last edited by rscape; Jul 24th, 2007 at 06:33 PM.

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Text doesn't echo..

    add this to the end:

    PHP Code:
    else
    {
    echo 
    "word_ok is equal to true";

    because $word_ok might be equal to true
    Last edited by dclamp; Jul 25th, 2007 at 01:21 AM.
    My usual boring signature: Something

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    7

    Re: Text doesn't echo..

    I've put that part in outside of the ifs and it shows, heres the new code:

    PHP Code:
    <?
    $to=$_POST['to'];
    $subject=$_POST['subject'];
    $body=$_POST['body'];
    $from=$_POST['from'];
    $headers = "From: $from" . "\r\n" .
        'MIME-Version: 1.0' . "\r\n" .
        'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

    if($word_ok!==false)
    {
        if($word_ok=="yes")
        {


    //mail($to,$subject,$body,$headers);

        if (@mail ($to, $subject, $body, $headers)) {

    echo "Email successfully sent to $to.";
        } else {
    echo "Error sending email!";
    }
        } else {
            echo "The word you entered for the image verification did not match what was displayed.<br />";


        }
    }
    echo "word_ok is equal to $word_ok";

    ?>
    It echos out "word_ok is equal to" so it equals nothing.

  4. #4
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    354

    Re: Text doesn't echo..

    I am stating the obivious here, but since $word_ok evaluates to nothing, set the variable to the proper value...

  5. #5
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Text doesn't echo..

    yes as sb said, it is set to the wrong value, and it is not going sending the email. put this right before your code:

    PHP Code:
    $word_ok "no"
    that should make it work.
    My usual boring signature: Something

Posting Permissions

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



Click Here to Expand Forum to Full Width