Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2009
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form problem php

    Form Problem with php get this error code when space words also when don't my space them some thing are not showing.

    How can space them and get each area to show in the email

    Here the part that are not showing in email

    Firstname:
    Lastname:
    Email: myemail@live.com
    Supporttype:
    Other:
    Comments: hi

    here the code I get when space names and support type
    Parse error: syntax error, unexpected T_STRING in /home/a9375737/public_html/contactformprocess.php on line 9


    HTML Code
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Northern Region Freight Contact US</title>
    <style type="text/css">
    <!--
    body {
    	background-color: #386643;
    	background-image: url(images/bg1.gif);
    	background-repeat: repeat-x;
    }
    -->
    </style>
    <link href="css/layout.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
    <div id="wrapper">
      <div id="logo"><img src="images/NRFlogo.jpg" alt="NRFlogo" width="980" height="200" /></div>
      <div id="navigation"></div>
      <div id="bodyArea">
        <div id="content"> <p align="center">&nbsp;</p>
          <form action="contactformprocess.php" method="post" name="form1" id="form1">
            <p align="left"><strong>        FirstName *        </strong>        </p>
            <p align="left">
              <input name="first name" type="text" id="first name" size="35" />
            </p>
            <p align="left">&nbsp;</p>
            <p align="left"><strong>Last Name* </strong></p>
            <p align="left">
              <input name="last name" type="text" id="last name" size="35" />
            </p>
            <p align="left">&nbsp;</p>
            <p align="left"><strong>Email *</strong></p>
            <p align="left">
              <input name="email" type="text" id="email" size="35" />
            </p>
            <p align="left">&nbsp;</p>
            <p align="left"><strong>Please Select Type of Support From list below</strong></p>
            <p align="left">
              <select name="support type" id="support type">
                <option selected="selected">Select one</option>
                <option value="Question">Question</option>
                <option value="Technical Support">Technical Support</option>
                <option value="Other">Other</option>
              </select>
            </p>
            <p align="left">&nbsp;</p>
            <p align="left"><strong>IF other please type it below</strong></p>
            <p align="left">
              <input name="other" type="text" id="other" size="35" />
            </p>
            <p align="left">&nbsp;</p>
            <p align="left">
              <textarea name="comments" id="comments" cols="45" rows="5"></textarea>
            </p>
            <p align="left">&nbsp;</p>
            <p align="left">
              <input type="submit" name="submit" id="submit" value="Submit" />
              <input type="reset" name="reset" id="reset" value="Reset" />
            </p>
            <p>&nbsp;</p>
          </form>
          
          <p>&nbsp;</p>
        </div>
        <div id="footer"></div>
      </div>
    </div>
    </body>
    </html>
    PHP code
    Code:
    <?php
    /* Subject and Email Veriables */
    
            $emailSubject = "Northern Region Freight Contact US";
            $webMaster = "usatrucker20076@yahoo.com";
    
    /* Gathering Data Veriables */
    
            $first nameField = $_POST['first name'];
    		$last nameField = $_POST['last name'];
    		$emailField = $_POST['email'];
    		$support typeField = $_POST['support type'];
    		$otherField = $_POST['other'];
    		$commentsField = $_POST['comments'];
    				      
    $body = "";
    $body .= "<br>";
    $body .= "<hr>";
    $body .= "<br>";
    $body .= "First name: " . $_POST['first name'] . "<br>\n";
    $body .= "Last name: " . $_POST['last name'] . "<br>\n";
    $body .= "Email: " . $_POST['email'] . "<br>\n";
    $body .= "Support type: " . $_POST['support type'] . "<br>\n";
    $body .= "Other: " . $_POST['other'] . "<br>\n";
    $body .= "Comments: " . $_POST['comments'] . "<br>\n";
    		
            $headers = "From: $email\r\n";
            $headers .= "Content-type: text/html\r\n";
            $success = mail("$webMaster", "$emailSubject", "$body", "$headers");
    
    /* Results rendered as HTML */
    
    $theResults = <<<EOD2
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Northern Region Freight </title>
    <style type="text/css">
    <!--
    body {
    	background-color: #386643;
    	background-image: url(images/bg1.gif);
    	background-repeat: repeat-x;
    }
    -->
    </style>
    <link href="css/layout.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
    <div id="wrapper">
      <div id="logo"><img src="images/NRFlogo.jpg" alt="NRFlogo" width="980" height="200" /></div>
      <div id="navigation"></div>
      <div id="bodyArea">
        <div id="content">
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">Thank you For your interest in Northern Region Freight we will </p>
          <p align="center">get back to you with 24 hours of submission.</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center"><br />
          </p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
        </div>
        <div id="footer"></div>
      </div>
    </div>
    </body>
    </html>
    
    EOD2;
    
    echo $theResults;
    
    ?>
    Last edited by newtocode; 10-10-2009 at 06:09 PM.

  • #2
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    spaces in your variable names == bad

    use underscores or camelcase in your HTML and php instead of spaces or you will get parse errors

  • #3
    New Coder
    Join Date
    Apr 2009
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    also why when don't space it is some of the feild not show like name support and question

    it look like this when get the email even those fill in everything.
    Firstname:
    Lastname:
    Email: myemail@live.com
    Supporttype:
    Other:
    Comments: hi

  • #4
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    PHP Code:
    <?php
    /* Subject and Email Veriables */

            
    $emailSubject "Northern Region Freight Contact US";
            
    $webMaster "usatrucker20076@yahoo.com";

    /* Gathering Data Veriables */

                   
    $firstnameField $_POST['firstname'];
            
    $lastnameField $_POST['lastname'];
            
    $emailField $_POST['email'];
            
    $supporttypeField $_POST['supporttype'];
            
    $otherField $_POST['other'];
            
    $commentsField $_POST['comments'];
                          
    $body "";
    $body .= "<br>";
    $body .= "<hr>";
    $body .= "<br>";
    $body .= "First name: " .  $firstnameField "<br>\n";
    $body .= "Last name: " $lastnameField "<br>\n";
    $body .= "Email: " $emailField  "<br>\n";
    $body .= "Support type: " .$supporttypeField"<br>\n";
    $body .= "Other: " $otherField "<br>\n";
    $body .= "Comments: " $commentsField "<br>\n";
            
            
    $headers "From: $email\r\n";
            
    $headers .= "Content-type: text/html\r\n";
            
    mail($webMaster$emailSubject$body$headers);
        

    /* Results rendered as HTML */

    $theResults = <<<EOD2
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Northern Region Freight </title>
    <style type="text/css">
    <!--
    body {
        background-color: #386643;
        background-image: url(images/bg1.gif);
        background-repeat: repeat-x;
    }
    -->
    </style>
    <link href="css/layout.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <div id="wrapper">
      <div id="logo"><img src="images/NRFlogo.jpg" alt="NRFlogo" width="980" height="200" /></div>
      <div id="navigation"></div>
      <div id="bodyArea">
        <div id="content">
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">Thank you For your interest in Northern Region Freight we will </p>
          <p align="center">get back to you with 24 hours of submission.</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
          <p align="center"><br />
          </p>
          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>
        </div>
        <div id="footer"></div>
      </div>
    </div>
    </body>
    </html>

    EOD2;

    echo 
    $theResults;

    ?>
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Northern Region Freight Contact US</title>
    <style type="text/css">
    <!--
    body {
    	background-color: #386643;
    	background-image: url(images/bg1.gif);
    	background-repeat: repeat-x;
    }
    -->
    </style>
    <link href="css/layout.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
    <div id="wrapper">
      <div id="logo"><img src="images/NRFlogo.jpg" alt="NRFlogo" width="980" height="200" /></div>
      <div id="navigation"></div>
      <div id="bodyArea">
        <div id="content"> <p align="center">&nbsp;</p>
          <form action="contactformprocess.php" method="post" name="form1" id="form1">
            <p align="left"><strong>        FirstName *        </strong>        </p>
            <p align="left">
              <input name="firstname" type="text" id="firstname" size="35" />
            </p>
            <p align="left">&nbsp;</p>
            <p align="left"><strong>Last Name* </strong></p>
            <p align="left">
              <input name="lastname" type="text" id="lastname" size="35" />
            </p>
            <p align="left">&nbsp;</p>
            <p align="left"><strong>Email *</strong></p>
            <p align="left">
              <input name="email" type="text" id="email" size="35" />
            </p>
            <p align="left">&nbsp;</p>
            <p align="left"><strong>Please Select Type of Support From list below</strong></p>
            <p align="left">
              <select name="supporttype" id="supporttype">
                <option selected="selected">Select one</option>
                <option value="Question">Question</option>
                <option value="Technical Support">Technical Support</option>
                <option value="Other">Other</option>
              </select>
            </p>
            <p align="left">&nbsp;</p>
            <p align="left"><strong>IF other please type it below</strong></p>
            <p align="left">
              <input name="other" type="text" id="other" size="35" />
            </p>
            <p align="left">&nbsp;</p>
            <p align="left">
              <textarea name="comments" id="comments" cols="45" rows="5"></textarea>
            </p>
            <p align="left">&nbsp;</p>
            <p align="left">
              <input type="submit" name="submit" id="submit" value="Submit" />
              <input type="reset" name="reset" id="reset" value="Reset" />
            </p>
            <p>&nbsp;</p>
          </form>
          
          <p>&nbsp;</p>
        </div>
        <div id="footer"></div>
      </div>
    </div>
    </body>
    </html>
    Last edited by met; 10-11-2009 at 11:38 AM.

  • #5
    New Coder
    Join Date
    Apr 2009
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it did not work those spot still not showing can't figure this out.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •