SitePoint Sponsor

User Tag List

View Poll Results: What is the best PHP book out there?

Voters
2. You may not vote on this poll
  • Professional PHP Programming (Wrox)

    0 0%
  • PHP/MySQL Web Development (Sams)

    2 100.00%
  • PHP Developers cookbook (Sams)

    0 0%
  • Web Application Development with PHP 4.0

    0 0%
Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Aug 2001
    Location
    Los Angeles, CA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ARRGG!! Why doesn't this PHP script work?!?!?

    Here's the link:

    http://www.html4me.com/augustandsept...1/htmlform.php

    And here's the PHP code for the form mail script:

    <?php
    if (($name != "") || ($email != "") || ($feedback != ""))
    {
    $send = "yes";
    }
    else
    {
    $send = "no";
    }
    $error_detection = 0;
    if ($name == "")
    {
    $send = "no";
    $error_detection = $error_detection + 1;

    $name_err = "<font face='arial' size='2' color='red'><b>There were some errors in processing your

    request/b><BR><BR>$error_detection /t Please fill in the <b>Name</b> field correctly.</font><BR><BR>";
    }
    else if ($email == "")
    {
    $send = "no";
    $error_detection = $error_detection + 1;
    $email_err = "<font face='arial' size='2' color='red'>$error_detection /t Please fill in the <b>Email</b> field

    correctly.</font><BR><BR>";
    }
    else if ($feedback == "")
    {
    $send = "no";
    $error_detection = $error_detection + 1;

    $feedback_err = "<font face='arial' size='2' color='red'>$error_detection /t Please fill in the <b>Feedback</b> field

    correctly.</font><BR>";
    }
    else if (send == "no")
    {
    echo "<HTML>";
    echo "$email_err";
    echo "$name_err";
    echo "$feedback_err";
    echo "</HTML>";
    }
    else if (send == "yes")
    {
    $feedback = StripSlashes($feedback); // hash out any special characters while script is running
    $subject = "feedback from web site";
    $mailcontent = "Customer name: ".$name."\n"
    ."Customer email: ".$email."\n"
    ."Customer comments: \n".$feedback."\n";
    $fromaddress = "info@html4me.com";
    mail($toaddress, $subject, $mailcontent, $fromcontent);
    echo "<HTML><head><title>Feedback sent!</title></head>";
    echo "<BODY><font face='arial' size='2'><h1><center>Feedback Sent!</center></h1></font><BR><BR>";
    echo "<font size='2' face='arial'>Your feedback/font><BR>";
    echo "<font face='arial' size='2'>";
    echo "$feedback";
    echo "</font>";
    echo "<BR>";
    echo "<font size='2' face='arial'>Thank you!</font></BODY></HTML>";
    }
    ?>


    Why doesn't this simple Form mail work?!?! I don't get it. No error messages are produced - I just get a blank screen each time.

    Thanks!

    Gregory C.
    Email: >> host@html4me.com
    Last edited by gregc; Aug 27, 2001 at 00:27.

  2. #2
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check this line:

    else if (send == "yes")

  3. #3
    SitePoint Addict
    Join Date
    Aug 2001
    Location
    Los Angeles, CA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    what about that line?

    What about it? Is it wrong? It seems fine.

    Gregory C.

  4. #4
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    send needs a dollar sign ($send).

  5. #5
    SitePoint Addict
    Join Date
    Aug 2001
    Location
    Los Angeles, CA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    OH MY GOSH I CAN'T BELIVE I DIDN'T SEE THAT!!!

    OH MY GOSH I CAN'T BELIEVE I DIDN'T SEE THAT. Haven't done any PHP in a while, just got back to it infact. Thanks though - I'll see how that all works out! I might post another one if the script still fails

    Gregory C.


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
  •