Need some help with this little PHP script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Realpascal
    Confirmed User
    • Jun 2005
    • 2119

    #1

    Need some help with this little PHP script

    It won't work with me.. am I overlooking something here ?

    Form:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Contact Us</title>
    <head></head>
    
    <body>
    <FORM METHOD=post ACTION="contactform.php">
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>&nbsp;</td>
        <td><div align="right">
          <p><img src="bel_small.gif" width="250" height="79" border="0"></p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
        </div></td>
      </tr>
      <tr>
        <td colspan="2">
    	<table width="600" border="0" align="center" cellpadding="2" cellspacing="0">
      <tr>
        <td colspan="2"><span class="style1">Contact us here </span></td>
      </tr>
      <tr>
        <td width="83">&nbsp;</td>
        <td width="417">&nbsp;</td>
      </tr>
      <tr>
    
        <td><span class="style2">Name</span></td>
        <td><input type="text" name="name" size="40"></td>
      </tr>
      <tr>
        <td><span class="style3">Email</span></td>
        <td><input type="text" name="email" size="40"></td>
      </tr>
      <tr valign="top">
        <td><span class="style3">Comment &nbsp;</span></td>
        <td><textarea name="comment" cols="60" rows="10"></textarea></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>
          <div align="center">
            <input type="submit" name="Submit">
          </div></td>
      </tr>
    </table>
    	</td>
      </tr>
    </table>
    <p align="right">&nbsp;</p>
    <p align="right">&nbsp;</p>
    <p align="right">&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    
    <p>&nbsp;</p>
    </body>
    </html>
    PHP mailscript
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head></head>
    <title>Contact Result</title>
    
    <body>
    
    <div align="center">
    
      <table width="800" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="2"><div align="center"><img src="bel_small.gif" width="250" height="79" border="0"></div></td>
        </tr>
      </table>
    
     
      <hr align="center" width="800">  
      
      
    <?php
    $formsent = mail("[email protected]", "Info req", "Submit by: $name\r\nEmail: $email\r\nComment: $comment");
    if($formsent hahahaha 1)
    {
    	  print("<p>Your comment has been sent. We will reply soon.</p>");
    }
    else
    	print("<p>Sorry, there's something wrong with the submitted form. Please try again</p>");
    ?>
      
      
        
      
    </div>
    </body>
    </html>
    Please help me out here..
    OMGWTFBBQ
  • Realpascal
    Confirmed User
    • Jun 2005
    • 2119

    #2
    Just for info: this is what i get in my email:

    Submit by
    Email
    Comment
    Please help...
    OMGWTFBBQ

    Comment

    • darksoul
      Confirmed User
      • Apr 2002
      • 4997

      #3
      very ugly code.

      anyway you need
      register_globals = On;
      in your php.ini
      1337 5y54|)m1n: 157717888
      BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
      Cambooth

      Comment

      • Realpascal
        Confirmed User
        • Jun 2005
        • 2119

        #4
        very ugly code
        I know.. but whatever works. I'm not an experienced PHP programmer. Maybe one day I'll be, and probably agree with you.

        Thanks for helping me with this man ! I'll get it fixed..
        OMGWTFBBQ

        Comment

        • chadglni
          Confirmed User
          • Dec 2002
          • 6924

          #5
          Originally posted by darksoul
          very ugly code.

          anyway you need
          register_globals = On;
          in your php.ini
          What he said... or add

          $name=$_POST['name'];
          $email=$_POST['email'];
          $comment=$_POST['comment'];

          right after your opening <?php tag


          Sign up here - Dating Site affiliate program

          Comment

          • Realpascal
            Confirmed User
            • Jun 2005
            • 2119

            #6
            Thanks man !!
            OMGWTFBBQ

            Comment

            • Damian_Maxcash
              So Fucking Banned
              • Oct 2002
              • 12745

              #7
              You should close the form tag in the HTML as well - thats not the problem but it should be done

              Comment

              • Realpascal
                Confirmed User
                • Jun 2005
                • 2119

                #8
                Done. Thanks !
                OMGWTFBBQ

                Comment

                Working...