How come when I use these lines my php goes nuts.
$name = isset($_POST['name']) ? trim($_POST['name']) : '';
parse error, unexpected T_VARIABLE in index.php on line 7
I get those errors.
However, I've seen it used in other examples with no errors.
It looks correct to me. Check the previous line for a syntax error, e.g., a missing terminating semi-colon.
that's just it. I can't see anything. Here is the full code.
<?php session_start(); include ('config.php'); include ('body.php'); include ('reg.php') if (isset($_POST['submit'])) { $errorname = ''; $name = isset($_POST['name']); if(strlen($name) < 5) $errorname = 'Your name must contain more than 5 characters'; if(strlen($name) > 14) $errorname = 'You can not exceed more than 14 characters'; else $errorname = 'Function is working as intended'; } ?>
Well I found this....
include ('reg.php')
changed to
include ('reg.php');
Fuzzylr;10937143 wrote:Well I found this.... include ('reg.php') changed to include ('reg.php');
That was my problem. LoL, thanks for your help.
No problem 🙂 Remember to mark this thread as resolved using the thread tools.