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

  • B
    Reply to Second attempt at a font (work in progress)
    B
    I like the overall look, but the width of some of the glyphs seems visually inconsistent. The G and O, for example, are pretty much based on circles where width roughly correspond to height, whereas the...
    Today, 04:25 PM
  • PrintDriver
    Reply to Adobe Illustrator expert needed
    PrintDriver
    Or just select both and click Command-8 (Create Compound path.) That works better if you have multiple shapes you are trying to knock through.
    Today, 04:24 PM
  • PrintDriver
    Reply to This is probably a pretty bad habit, but I want to know why.
    PrintDriver
    You do NPS work B, right? I'm surprised you haven't taken InDesign a little sideways when doing some of that. We just finished up a very creative project for a Park that the designer created in InDesign....
    Today, 04:20 PM
  • B
    Reply to Help with identifying texture on this background?
    B
    Or take a quick photo of something with some visual texture, like a stucco wall, a concrete sidewalk, a tiled floor, etc., then just start using PS's various tools to darken, desaturate, enhance, dodge,...
    Today, 03:58 PM
  • B
    Reply to This is probably a pretty bad habit, but I want to know why.
    B
    Yeah, over the years (and for better or worse) Photoshop, Illustrator and InDesign have incorporated rudimentary and often clumsy implementations of the most-used tools and capabilities from the other...
    Today, 03:47 PM

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