Results 1 to 3 of 3

Thread: Please Check my code (PHP)

  1. #1
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Please Check my code (PHP)

    Please check my code , when i click submit in html page
    the browser just displayes the code as it is it does not executes them Please check

    <?
    if ($_POST["action"] == "send"){

    if ($_POST["name"] and $_POST["email"] and $_POST["message"] ){

    mail (
    "laser@xyz.com,
    "reply",
    "
    Name: ".$_POST['name']."
    E-mail: ".$_POST['email']."
    Message: ".$_POST['message']."

    ",
    "From: ".$_POST['name']." <".$_POST['email'].">");

    echo '<p align="center"><font color="#003366">Thanks !<br>Your message has been sent.<br> I got it.</font></p>';

    }

    else{
    echo '<p align="center"><font color="#FF0000">Please fill in all data!<br>All fields are obligatory.</font></p><p><a href="contactEN.html">[back]</a>';

    }
    }

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    If it just displays the code, you may not have php enabled on your server. Also, you may want to try opening your php script using the full opening tag (just in case your server turned off the option for short open tags). The long tag looks like this:

    Code:
    <?php
    //php code here
    ?>
    Talk to your host and see if php is installed on your server. If it is, make a page that displays the php info.

    Code:
    <?php
    phpinfo();
    ?>
    If that doesn't work, then you know it is the server.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    That "and" keyword in the if statement be &&.
    - Mike

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
  •