...

View Full Version : unexpected T_ECHO



Adbem
01-31-2010, 12:19 PM
it is a php script wchich i want to put on my website but it showes an unexpected T_ECHO on line 6. Thats the code

<?php


if (
(!empty($_POST['name'])) or (!empty($_POST['email'])) or (!empty($_POST['title']))
echo"fill in all fields";
)


else (
mail ('kontakt@mywebsite.com', '$title', '$text')
echo"it was send correctly, go back on <a href=\"http://www.mywebsite.com\">main page</a><br />
or to <a href=\"http://www.mywebsite.com\">cobntact formular</a>";
)

?>

Ps sorry for my english

kbluhm
01-31-2010, 12:29 PM
There is no need to echo function parameters.

And no need to nest [php] tags within [code] tags when displaying PHP code.

Adbem
01-31-2010, 12:54 PM
ok but can you help me because i tried everything and i have no idea what is wrong

xiaodao
01-31-2010, 01:22 PM
<?php


if (!empty($_POST['name'])||!empty($_POST['email'])||!empty($_POST['title'])){
echo"fill in all fields";
}else {
mail ('kontakt@mywebsite.com', '$title', '$text');
echo"it was send correctly, go back on <a href=\"http://www.mywebsite.com\">main page</a><br />
or to <a href=\"http://www.mywebsite.com\">cobntact formular</a>";
}

?>


try

kbluhm
01-31-2010, 02:14 PM
Ah, your code wasn't very readable, and without the semicolon it appeared that you were echoing a parameter.

masterofollies
01-31-2010, 04:37 PM
Trying giving some whitespace for a cleaner code.


<?php


if (!empty($_POST['name']) || !empty($_POST['email']) || !empty($_POST['title'])) {
echo 'fill in all fields';
}
else {
mail ('kontakt@mywebsite.com', '$title', '$text');
echo"it was send correctly, go back on <a href=\"http://www.mywebsite.com\">main page</a><br />
or to <a href=\"http://www.mywebsite.com\">cobntact formular</a>";
}

?>

PappaJohn
01-31-2010, 04:54 PM
You have mismatched parentheses:

This:

if (!empty($_POST['name'])||!empty($_POST['email'])||!empty($_POST['title'])){
should be

if ((!empty($_POST['name'])||!empty($_POST['email'])||!empty($_POST['title'])){



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum