While everyone else is entirely correct to point that you shouldn't be assigning values to the $_POST
superglobal, it is possible for you to make such an assignment. The $_POST
superglobal is just an array, after all, and so it acts like one.
The error you're seeing is because PHP is recognizing $_POST['name']
as being part of the previous statement. Check to make sure that you have properly ended the previous statement (i.e. the line before $_POST['name'] = $name
ends with a ;
).
You probably do want to be assigning $_POST['name']
to a variable, rather than the other way around as you have it now, but that's not what's causing the error.