# Echo is not displayed

**URL:** <https://www.phphelp.com/t/echo-is-not-displayed/26251>\
**Category:** General PHP Help\
**Created:** [February 10, 2018, 7:56pm UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251 "2018-02-10T19:56:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://www.phphelp.com/uploads/default/original/2X/2/243e9ed5d93c5653ce3186f18df16e019ce38445.png) [@system](https://www.phphelp.com/u/system)\
**Post date:** [February 10, 2018, 7:56pm UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251/1 "2018-02-10T19:56:32Z")

</div>

What’s wrong there? The echo it isn’t showed.

[php]\<?php

```
$name = $_POST['Nume'];
$phone = $_POST['Telefon'];
$email = $_POST['Email'];
$subject = $_POST['Subiect'];
$message = $_POST['Mesaj'];
$formcontent = "*De la: $name \n *Telefon: $phone \n *Email: $email \n *Mesaj: $message";
						
if($name !='' && $email !='' && $subject !='' && $message !=''){
(mail('resolveit@yahoo.com', $subject, $formcontent);
							
echo "Mesaj trimis!";
}
else{
echo "Trebuie sa completezi toate campurile cu *";
}

```

?\>[/php]

---

<div class="post-metadata">

**Author:** ![Valkrider](https://www.phphelp.com/user_avatar/www.phphelp.com/valkrider/32/775_2.png) [@Valkrider](https://www.phphelp.com/u/Valkrider)\
**Post date:** [February 11, 2018, 8:49am UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251/2 "2018-02-11T08:49:45Z")

</div>

Which echo statement you have 2?

---

<div class="post-metadata">

**Author:** ![PkraM](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/e0b2c6/32.png) [@PkraM](https://www.phphelp.com/u/PkraM)\
**Post date:** [February 11, 2018, 10:45am UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251/3 "2018-02-11T10:45:19Z")

</div>

Enable display\_errors or error\_logging or check your error logs.

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [February 12, 2018, 9:03am UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251/4 "2018-02-12T09:03:51Z")

</div>

You have an error

---

<div class="post-metadata">

**Author:** ![phdr](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@phdr](https://www.phphelp.com/u/phdr)\
**Post date:** [February 12, 2018, 4:02pm UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251/5 "2018-02-12T16:02:14Z")

</div>

You have a fatal php parse/syntax error on line 11 and your code is not running at all.

You need to set php’s error\_reporting to E\_ALL and display\_errors to ON, in the php.ini on your development system (you cannot put these settings into your code and have them work for this type of error since your code doesn’t run) so that php will help you when learning, developing, and debugging code.

---

<div class="post-metadata">

**Author:** ![PkraM](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/e0b2c6/32.png) [@PkraM](https://www.phphelp.com/u/PkraM)\
**Post date:** [February 13, 2018, 1:10pm UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251/6 "2018-02-13T13:10:23Z")

</div>

Change:

```auto
(mail('resolveit@yahoo.com', $subject, $formcontent );
```

To:

```auto
(mail('resolveit@yahoo.com', $subject, $formcontent) );
```

Missing closing bracket… “)”

Also see the PHP documentation for displaying errors.

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [February 13, 2018, 1:25pm UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251/7 "2018-02-13T13:25:33Z")

</div>

PkraM, the function does not need to be wrapped in parentheses. Adding the missing one does not make it better, when the first part shouldn’t be there.

---

<div class="post-metadata">

**Author:** ![PkraM](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/e0b2c6/32.png) [@PkraM](https://www.phphelp.com/u/PkraM)\
**Post date:** [February 13, 2018, 3:48pm UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251/8 "2018-02-13T15:48:22Z")

</div>

> [@astonecipher](#):
>
> PkraM, the function does not need to be wrapped in parentheses. Adding the missing one does not make it better, when the first part shouldn’t be there.

lol - True! ;D Just working with what was there…

Try:

[code]$name = $\_POST[‘Nume’];

$phone = $\_POST[‘Telefon’];

$email = $\_POST[‘Email’];

$subject = $\_POST[‘Subiect’];

$message = $\_POST[‘Mesaj’];

$formcontent = “\*De la: $name \n \*Telefon: $phone \n \*Email: $email \n \*Mesaj: $message”;

if($name !=‘’ && $email !=‘’ && $subject !=‘’ && $message !=‘’) {

```
if( mail('resolveit@yahoo.com', $subject, $formcontent ) ) {
   
echo "Mesaj trimis!";

```

}  
else{

```
echo "Trebuie sa completezi toate campurile cu *";

```

}

}[/code]

---

<div class="post-metadata">

**Author:** ![phdr](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@phdr](https://www.phphelp.com/u/phdr)\
**Post date:** [February 13, 2018, 4:13pm UTC](https://www.phphelp.com/t/echo-is-not-displayed/26251/9 "2018-02-13T16:13:16Z")

</div>

[member=88301]PkraM[/member],

Posting ‘fixed’ code or code to try, without including an explanation of what was fixed or why to do something differently, is not helpful. It doesn’t teach anything.

You have also incorrectly altered the OP’s program logic, so that the - “You must fill in all fields…” output will be displayed when the mail() call fails, not when one or more of the form field values are empty. Wouldn’t a message indicating that the email could not be sent (and logging the actual error information being returned to php) be the ‘fixed’ logic?

If you are serious about helping, take the time to post things that add to the thread you are posting in.
