Results 1 to 7 of 7

Thread: Simple Error Help [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    Simple Error Help [RESOLVED]

    I'm only new to PHP, I'm making a simple script and have an simple error can someone help with it please

    The Error is Parse error: parse error in /home/httpd/vhosts/httpdocs/includes/test.php on line 29

    PHP Code:
    <body>

    <php

    if ($action == "save")
    {
    echo "save";

    $to = "[email protected]";
    $subject = "PHP Is Great";
    $body = "PHP is one of the best scripting languages around";
    $headers = "From: [email][email protected][/email]\n";
    mail($to,$subject,$body,$headers);
    echo "Mail sent to $to";

    }else{
    ?>
    <form method="POST" action="test.php?action=save">

      <p><input type="text" name="T1" size="20"></p>
      <p><input type="radio" value="V1" name="R1"></p>
      <p><input type="radio" value="V2" checked name="R1"></p>
    <input type="submit" value="Submit" name="B1">
    <input type="reset" value="Reset" name="B2">

    </form>
    <?php
    }
    ?>

    </body>
    Last edited by kiwis; Apr 3rd, 2004 at 11:46 PM.

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    it should be:
    PHP Code:
    <body>

    <?php

    if ($action == "save")
    {
    echo 
    "save";

    $to "[email protected]";
    $subject "PHP Is Great";
    $body "PHP is one of the best scripting languages around";
    $headers "From: [email][email protected][/email]\n";
    mail($to,$subject,$body,$headers);
    echo 
    "Mail sent to $to";

    }else{
    ?>
    <form method="POST" action="test.php?action=save">

      <p><input type="text" name="T1" size="20"></p>
      <p><input type="radio" value="V1" name="R1"></p>
      <p><input type="radio" value="V2" checked name="R1"></p>
    <input type="submit" value="Submit" name="B1">
    <input type="reset" value="Reset" name="B2">

    </form>
    <?php
    }
    ?>

    </body>
    You'd missed out the ? in the very first <?php
    Have I helped you? Please Rate my posts.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139
    sweet but the email does not send :-( any ideas?

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    what OS does your server have? if it's windows, do you have SMTP configured? if you're on unix, do you have sendmail installed?
    Like Archer? Check out some Sterling Archer quotes.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139
    Originally posted by kows
    what OS does your server have? if it's windows, do you have SMTP configured? if you're on unix, do you have sendmail installed?
    It's unix, it must be turned on this scripts works

    PHP Code:

    <?php

            
    if ($action == "send")
            {
            
    ?>
                    <font class="bluetest2"><strong>THANK YOU</strong></font></p>
              <p>Thank you for sending feedback.
              <br><br>
              <b><a href="http://www.gg.com">Click here to return to
              <span lang="en-au"></span> main</a></b>
              <br>
                <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>

     
            <?php


            
    if ($name <> "")
            {
                
    $message "From: ";
                
    $message .= $name;
                
    $message .= "\n\n";
            }
            if (
    $email <> "")
            {
                
    $message "Email: ";
                
    $message .= $email;
                
    $message .= "\n\n";
            }

                
    $message .= $feedback;



                
    /* recipients */
                
    $recipient "Site Feedback <[email protected]>"//note the comma
                /* subject */
                
    $subject "Site Feedback";
                
    /* message */
                /* additional header pieces for errors, From cc's, bcc's, etc */
                
    $headers .= "From: Feedback \n";
                
    $headers .= "X-Sender: <[email protected]>\n";
                
    $headers .= "X-Mailer: PHP\n"// mailer
                
    $headers .= "Return-Path: <[email protected]>\n"// Return path for errors
                /* If you want to send html mail, uncomment the following line */
                // $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
                //$headers .= "cc:[email protected] \n"; // CC to
                //$headers .= "bcc:[email protected], [email][email protected][/email] \n"; // BCCs to
                /* and now mail it */

            
    mail($recipient$subject$message$headers);


            } else {

            
    ?>
            <br>
            <b>You can contact the <span lang="en-au">suppoters</span> Site Webmaster at <a href="mailto:[email protected]">[email protected]</a>.</b><br>
            <br><br>
            Or you can fill out the form below:
            <br><br>


                    <font class="bluetext2"><strong>Please fill in the feedback form below:</strong></font></p>
                    <form method="POST" action="contact.php?action=send">
                      <p><strong>Name:</strong> <font size="3">
                      <input type="text"
                      name="name" size="30" style="border-style: solid; border-width: 1"></font> (optional)<br>
                      <strong>Email:</strong> <font size="3">
                      <input type="text" name="email" size="30" style="border-style: solid; border-width: 1"></font>
                      (optional)<br>
                      <br>
                      <strong>Feedback:</strong><br>
                      <font size="3">
                      <textarea rows="12" name="feedback" cols="50" style="border-style: solid; border-width: 1"></textarea></font><br>
                      <br>
                      <br>
                      <input type="submit" value="Submit Feedback" name="B1" style="border-style: solid; border-width: 1"></p>
                    </form>
            <?php

            
    }

            
    ?>

  6. #6
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    try adding two lines breaks to the end of your message's body.. or some more headers.
    Like Archer? Check out some Sterling Archer quotes.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139
    Originally posted by kows
    try adding two lines breaks to the end of your message's body.. or some more headers.
    Got it woking :-)
    thanks

    However it does not have anything in the body of the email... arr why?

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