Announcement Announcement Module
Collapse
No announcement yet.
I need help with PHP!!! Page Title Module
Move Remove Collapse
Search Search Module
Collapse

Advertisement Advertisement Module
Collapse

Latest Topics Latest Topics Module
Collapse

  • AJP
    Best way to do transparency on drop caps?
    AJP
    I have some large drop caps and wish to make them 30% transparency. However, ID doesn't seem to offer the option to make a single letter (within a block of text) a separate transparency. Short of coloring...
    Today, 04:37 AM
  • donwu212
    Logo Design for Neighborhood Council
    donwu212
    Hey everyone. This is my first post and hoping to get some feedback on two logo designs.

    I'm re-designing a logo for a neighborhood council organization called Brighton Park Neighborhood...
    Today, 12:40 AM
  • PrintDriver
    Reply to Donald Trump for President!
    PrintDriver
    The debates are going to be a sideshow. It's almost like the rest of the country doesn't exist right now except for NH and Iowa. None of them have addressed any really important issues. And I mean on...
    Today, 12:35 AM
  • PrintDriver
    Comment on Do I need to market myself ?
    PrintDriver
    Starting a business after being in the industry working for someone that knows what they are doing BEFORE freelancing makes more sense.
    Today, 12:32 AM
  • PrintDriver
    Reply to Templates- to use or not?
    PrintDriver
    Oh yeah. Found it. You promised your work was original work when you signed up.
    No Templates for You.

    The Freelancer really gets the sh!t end of the stick here.

    Did you...
    Today, 12:20 AM

X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • I need help with PHP!!!

    I'm doing an EASY online form that should not be that hard, but it's giving me a error:

    Parse error: syntax error, unexpected $end in D:\Hosting\4691023\html\newsletprocess.php on line 55

    I don't understand . . this shouldn't be that hard? Can anybody help me?? What am I doing wrong?

    <?php

    /* Subject and Email Variables */

    $emailSubject = 'Send me the e-newsletter!';
    $webMaster = 'christy@phoenixdesignandprint.com';

    /* Gathering Data Variables */

    $nameField = $_POST['name'];
    $companynameField = $_POST['companyname'];
    $emailField = $_POST['email'];

    $body = <<<EOD
    <br><hr><br>
    Name: $name <br>
    Company Name: $companyname <br>
    Email Address: $email <br>
    EOD;

    $headers = "From: $email\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailSubject, $body, $headers);


    /* Results rendered as HTML */

    $theResults = <<<EOD
    <html>
    <title>Thank you for subscribing to our e-newsletter!</title>

    <style type="text/css">
    <!--
    body p {
    font-family: Verdana, Geneva, sans-serif;
    }
    body p {
    text-align: center;
    }
    body p {
    font-size: 12px;
    }
    -->
    </style>
    <body>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>Thank you for subscribing to our e-newsletter!</p>
    <p><a href="index.html">Click here to go back to home page</a></p>
    </body>
    </html>
    EOD;
    echo "$theResults";
    ?>

  • #2
    I have never seen this EOD thing before but apparently it's acceptable PHP.

    I don't think this line should work:
    $headers = "From: $email\r\n";
    I've seen
    $headers = "From: " . $email . "\r\n";
    and
    $headers = "From: {$email}\r\n";

    This line is definitely not going to work:
    echo "$theResults";
    it should be:
    echo $theResults;

    Your variables you're referencing are not defined, either. You say $name and $companyname, but the names you've given them are $nameField and $companynameField.

    The error unfortunately is very vague - usually it means something's not closed in the code. I would stay away from this EOD stuff and just use double quotes.

    Not to mention using php for the end bit is totally pointless, you can just shut php and write it out:
    Code:
    <?php
    
    /* Subject and Email Variables */
    
    $emailSubject = 'Send me the e-newsletter!';
    $webMaster = 'christy@phoenixdesignandprint.com';
    
    /* Gathering Data Variables */
    
    $name = $_POST['name'];
    $companyname = $_POST['companyname'];
    $email = $_POST['email'];
    
    $body = <<<EOD
    <br><hr><br>
    Name: $name <br>
    Company Name: $companyname <br>
    Email Address: $email <br>
    EOD;
    
    $headers = "From: {$email}\r\n";
    $headers .= "Content-type: text/html\r\n";
    mail($webMaster, $emailSubject, $body, $headers);
    ?>
    <html>
    <title>Thank you for subscribing to our e-newsletter!</title>
    
    <style type="text/css">
    <!--
    body p {
    font-family: Verdana, Geneva, sans-serif;
     text-align: center;
     font-size: 12px;
    }
    -->
    </style>
    <body>
     <p>Thank you for subscribing to our e-newsletter!</p>
    <p><a href="index.html">Click here to go back to home page</a></p>
    </body>
    </html>
    Can I see the HTML for the form? I think you may have just mixed up post variables.
    Last edited by vanishdesign; 08-22-2009, 04:44 AM.
    Swedish Meatball Pornography

    Comment


    • #3
      the <<<EOD bit is a here doc and looks to be formatted correctly...however, the ending EOD; part cannot have any whitespace preceding it or it will throw an error...it's tricky that way...do a hard return after that <br> tag and make sure it rests flush with the side of your code editor by the line numbers...

      and ensure your variable names are the same...
      Monarchs Rule!

      Comment


      • #4
        Each line of the body can be no longer then 70 characters.

        You should get the undefined variables sorted out first though.
        Last edited by tZ; 08-22-2009, 06:54 AM.

        Comment


        • #5
          Can I see the HTML for the form? I think you may have just mixed up post variables.

          http://highpointehs.com/newsletter.html

          Comment


          • #6
            I'll look it over, but one thing I immediately noticed is that size has been used rather then maxlength. The size attribute is visual and does not mean the number of characters. The allowed number of characters is determined by maxlength not size. Even then its only client-side and should always be checked on the server side as well which I don't believe your doing. Doing that will also raise an issue of providing the user information about what fields are invalid and how they can fixed accordingly which also has yet to be addressed.
            Last edited by tZ; 08-22-2009, 11:15 PM.

            Comment


            • #7
              Code:
              $name = $_POST['FieldData0'];
              $companyname = $_POST['FieldData1'];
              $email = $_POST['FieldData2'];

              Comment

              Mediabistro A division of Prometheus Global Media home | site map | advertising/sponsorships | careers | contact us | help courses | browse jobs | freelancers | content | member benefits | reprints & permissions terms of use | privacy policy Copyright © 2015 Mediabistro Inc.
              Working...
              X