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

Featured Images Featured Images Module
Collapse

Mediabistro Creative Sites Mediabistro Creative Sites Module
Collapse
Latest Topics Latest Topics Module
Collapse

  • <b>
    Reply to Is there a member list here?
    <b>
    I wonder if making a few sacrificial offerings -- maybe two or three virgin forum members -- to the new forum gods will help persuade them....
    Today, 01:27 AM
  • Buda
    Reply to Best Printer For Graphic Design
    Buda
    How many prints will you be printing per day? Per week? Per month?

    You're looking for a wide format inkjet and make sure you check out what types of inks are available. More likely, you will...
    Today, 12:55 AM
  • Buda
    Reply to Hi All!! Want to shift career to Graphic designing
    Buda
    Surely there is something that attracted you to graphic design. What was it? Maybe there is a niche you could be focusing your energy into learning.

    The shortcut to learn "graphic design"...
    Today, 12:48 AM
  • ISitude
    Reply to Redundancy & Entropy
    ISitude
    That is at the heart of the matter ... subjectivity and your perception as a graphic designer to (re)interpret and communicate.

    The math side of this issue I think is not your teacher's literal...
    Today, 12:35 AM
  • Buda
    Reply to Hot Topics
    Buda
    Hi Cole Ericson and welcome to GDF.

    We ask every new member to read the threads posted HERE, particularly this thread to get acquainted with how things work on GDF. They will explain how...
    Today, 12:20 AM
Advertisement Advertisement Module
Collapse

Sponsors Sponsors Module
Collapse

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

               
              home | site map | advertising/sponsorships | about us | careers | contact us | help courses | browse jobs | freelancers | events | forums | content | member benefits | reprints & permissions about | terms of use | privacy policy | Copyright © 2014 Mediabistro Inc. Mediabistro Inc. call (212) 389-2000 or email us
              Working...
              X