pandik70 pandik70 - 1 month ago 11
PHP Question

Fatal error: Can't use function return value in write context on line 50

I am doing sharing form and I canĀ“t find out the problem. What am I doing wrong?

<?php
if ($hlaska)
echo('<p>' . htmlspecialchars($hlaska) . '</p>');

$vasemail = (isset($_POST['vasemail'])) ? $_POST['vasemail'] : '';
$email = (isset($_POST['email'])) ? $_POST['email'] : '';
$predmet = (isset($_POST('predmet')) ? $_POST['predmet'] : '';
$zprava = (isset($_POST['zprava'])) ? $_POST['zprava'] : '';
?>


This is code about line 50. Line 50 is starting with $predmet
For full code I am pasting link http://paste.ofcode.org/dNSwRTjLkbx5kcqFMzwUbt

If I comment or delete all code contenting something with $predmet it works as it should. $predmet is in English $subject FYI.

Answer

Just because of this $_POST('predmet')

This should be:

$predmet = (isset($_POST['predmet'])) ? $_POST['predmet'] : '';

You are getting the Fatal Error because this $_POST('predmet') consider here as a method which is wrong this is Super Global.