-5

PHP newbie. Keep getting

Parse error: syntax error, unexpected T_ECHO

with my code.

<?php
header('Location: http://www.dcaccountancyservices.com/index.php?option=com_chronoforms&tmpl=component&chronoform=EditClient&token='  echo $client['id']);
?>

Cannot figure out what the syntax error is. Thanks.

hakre
  • 193,403
  • 52
  • 435
  • 836
  • Please show your code so that easy to find error. – Prem Oct 22 '12 at 12:42
  • Welcome to Stackoverflow. Please follow the [ask advice](http://stackoverflow.com/questions/ask-advice) you needed to confirm before posting *any* question. Keep in mind that only you want something and you ask yourself how it is programmed does not qualify as a programming question per-se. For example search before ask: http://stackoverflow.com/search?q=%5Bphp%5D+Parse+error%3A+syntax+error%2C+unexpected+T_ECHO - And take a look to the right, the **Related** column. – hakre Oct 22 '12 at 12:43
  • Also please take a look at this reference question, you might find this helpful: http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php – hakre Oct 22 '12 at 12:48

5 Answers5

2

At the very end of your line, you have:

echo $client['id']);

You're trying to append the $client['id'] to the URL, so remove the echo and replace it with .:

header('Location: http://www.dcaccountancyservices.com/index.php?option=com_chronoforms&tmpl=component&chronoform=EditClient&token=' . $client['id']);
newfurniturey
  • 37,556
  • 9
  • 94
  • 102
1

You have to concatenate the values:

<?php
header('Location: http://www.dcaccountancyservices.com/index.php?option=com_chronoforms&tmpl=component&chronoform=EditClient&token='  . $client['id']);
jantimon
  • 36,840
  • 23
  • 122
  • 185
  • I'd say if the error message is too complicated for the OP, there is a problem with your answer because the code-example needs scrolling. ;) – hakre Oct 22 '12 at 12:46
0

try this

<?php
header('Location: http://www.dcaccountancyservices.com/index.php?option=com_chronoforms&tmpl=component&chronoform=EditClient&token='.$client['id']);
?>
Vladimir Gordienko
  • 3,260
  • 3
  • 18
  • 25
0
header('Location: http://www.dcaccountancyservices.com/index.php?option=com_chronoforms&tmpl=component&chronoform=EditClient&token='.$client['id']);
Svetoslav
  • 4,686
  • 2
  • 28
  • 43
0

You do not use echo when you want to concatenate a string, you use . (dot). So change the your header line to:

header('Location: http://www.dcaccountancyservices.com/index.php?option=com_chronoforms&tmpl=component&chronoform=EditClient&token='.$client['id']);
borrible
  • 17,120
  • 7
  • 53
  • 75