Jump to content

Help Needed!


runawaykinms

Recommended Posts

Hello, I am new to PHP and I have created a page for a friends website. When I try to send this document I get the following error:

 

Parse error: syntax error, unexpected $end in /home/oranda/public_html/monthly_report.php on line 111

 

I am not sure what the problem is, I have searched other forums, but can't find the solution. Any suggestions?

 

I have attached the document with the code.

 

Thanks for the help in advance!

 

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/193546-help-needed/
Share on other sites

It was an error on ending the heredoc syntax, but moving ; one line below is not the problem - adding space like this fixed it (showing from line 103)

  </tr>
</table>
</body>
</html>

EOD;

echo $theResults;

 

When that is said you dont need to run all this html through heredoc since you arent filling in any php variables at all as far as i can see

 

*edit* EOD without space in front of it, shows poorly in the code block on this forum

Also i recoment creating a better description rather than "Help Needed" etc when creating forum topics - most topics are created because the topic starter needs help.

Link to comment
https://forums.phpfreaks.com/topic/193546-help-needed/#findComment-1018876
Share on other sites

Thank you very much for the help thus far. I was able to submit the form without an error, however, I am having a new problem.

 

When I received the email, the data that is entered in the form field was not there. I tried this a couple of times, and each time the email goes through, but without the information entered.

 

Is something wrong with my code? The original file should be attached to this post.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/193546-help-needed/#findComment-1019255
Share on other sites

The variables from POST does not match the one used in email body,

example: $apt1Field is declared from POST apt1 while inside email body it looks for variable $apt1

/* Information Variables */
$monthField = $_POST['month'];
    $apt1Field = $_POST['apt1'];
    $apt2Field = $_POST['apt2'];
    $apt3Field = $_POST['apt3'];
    $apt4Field = $_POST['apt4'];
    $apt5Field = $_POST['apt5'];
    $apt6Field = $_POST['apt6'];
    $totalField = $_POST['total'];
    $fromField = $_POST['from'];
    
    $body = <<<EOD
<br /><hr /><br />
Email: $month <br />
708 Front St: $apt1 <br />
708 1/2 Front St: $apt2 <br />
218 N. Park Ave: $apt3 <br />
220 N. Park Ave: $apt4 <br />
1236 Sycamore St: $apt5 <br />
1236 1/2 Sycamore St: $apt6 <br />
Total: $total <br />
From: $from <br />
EOD;

Link to comment
https://forums.phpfreaks.com/topic/193546-help-needed/#findComment-1019301
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.