[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
For fuck sake, kill me What is the error here $->Body =
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 21
Thread images: 2
File: error.png (17 KB, 1111x712) Image search: [Google]
error.png
17 KB, 1111x712
For fuck sake, kill me

What is the error here

$->Body = 'From: ' . $fields['name'] . ' (. $fields['email'] .)<p>' . $fields['message'] . '</p>';


Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting variable (T_VARIABLE) or '{' or '$' in C:\xampp\htdocs\libs\contact.php on line 38

Notice: Undefined index: errors in C:\xampp\htdocs\libs\index.php on line 5

require_once 'phpmailer/PHPMailerAutoload.php';

Just fucking kill me, can anyone help. Fuck PHP, fuck it all.

I know it says no help but this is the only place I can turn to
>>
>>53376087
>expecting variable
>>
>>53376087
You can blame PHP for many things, but not your stupidity.
>>
>>53376102
I seriously can't see where I'm so bad at php

>>53376110
Only if I could, never done php before. I can't see where the problem is, I think I'm missing a variable but fucking hell just end me
>>
>>53376120
>Only if I could, never done php before. I can't see where the problem is, I think I'm missing a variable but fucking hell just end me
I've written PHP maybe once in my life 10 years ago and I can see where the error is just fine.

Like I said, don't blame PHP for your own incompetence.
>>
>>53376153
Not even going to lie, I'm not good at this. How can you see the error? I'm working on the undefined index right now.

I'm still learning...everything, to think I have to do a login next.
>>
>>53376153
I thought I saw the error, I do not.

I thought it was not enclosing it in operators
>>
>>53376206
>I thought I saw the error, I do not.

$->Body
shoud be
$objectName -> Body
>>
>>53376153
I SEE THE PROBLEM
OH FUCK HOW DIDN'T I SEE IT
>>
>>53376227
Thank you, I'd actually repay you if there was a way, got steam?
>>
>>53376241
No need ;)
>>
>>53376263
Thank you so much for your help, I owe you
>>
>>53376180
>How can you see the error?

Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting variable (T_VARIABLE) or '{' or '$' in C:\xampp\htdocs\libs\contact.php on line 38


>Parse error: syntax error, unexpected '->', expecting variable

>Unexpected ->

>
$->Body = 'From: ' ...


Can't you read even basic compiler errors?
>>
>>53376273
btw, you should use
htmlspecialchars() for displaying any text that could have some special characters like <>'"&. If you not, your page will break.

for example:
htmlspecialchars($fields['message'])

https://secure.php.net/manual/en/function.htmlspecialchars.php
>>
>>53376329
I was stressed out, I'm dealing with a whole new problem now. I'm new to all of this and I'm trying to get stuck in by using PHP/ SQL/ASP.NET

So I figured I'd try a basic contact form, I found this tutorial from "CodeCourse"

https://www.youtube.com/watch?v=FtWD_ZH9lnE

Everything doesn't work
>>
>>53376362

         $m->Body = 'From: ' . $fields['name'] . '. $fields['email'] . '<p>' . ' $fields['message'] . '</p 


Is that why I'm getting "syntax error, unexpected 'email' (T_STRING)"?

In the email I'm guessing it should be ""
>>
>>53376241
>>>/r/reddit
>>
Maybe, just maybe, if you read the fucking error message and used that brain of yours even slightly you would figure out what the error is. Here, let me define a couple words for you:

Unexpected: something is there that shouldn't be
Expecting: Something should be there that shouldn't be.

Logical conclusion: Something needs to be replaced with something else. And it TELLS YOU EXACTLY WHAT THAT IS! If you can't figure that out from the error message you shouldn't be programming.
>>
>>53376367
You can't make satire this good
>>
>>53376398
try now
$object -> Body = 'From: ' . $fields['name'] . ' (' . $fields['email'] . ')<p>' . $fields['message'] . '</p>';

or
$object -> Body = 'From: {$fields['name']} ({$fields['email']})<p>{$fields['message']}</p>';
>>
File: high.png (2 KB, 1060x178) Image search: [Google]
high.png
2 KB, 1060x178
>>53376398
And this is why you use syntax highlighting.
Thread replies: 21
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.