debuitls Posted September 2, 2009 Share Posted September 2, 2009 Hi all, I'm trying to learn php and was just wondering if anyone could suggest to me why the following line of code is incorrect? $message = "Hello, your reference number is" $_GET["to"]; Any suggestions would be much appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/172859-simple-syntax-error/ Share on other sites More sharing options...
JonnoTheDev Posted September 2, 2009 Share Posted September 2, 2009 You must concatonate using a period $message = "Hello, your reference number is ".$_GET['to']; Quote Link to comment https://forums.phpfreaks.com/topic/172859-simple-syntax-error/#findComment-911059 Share on other sites More sharing options...
mikesta707 Posted September 2, 2009 Share Posted September 2, 2009 2 things. you have to use the "." character to concatenate strings. two associative array keys must be surrounded with single quotes $message = "Hello, your reference number is " . $_GET['to']; Quote Link to comment https://forums.phpfreaks.com/topic/172859-simple-syntax-error/#findComment-911061 Share on other sites More sharing options...
debuitls Posted September 2, 2009 Author Share Posted September 2, 2009 Ah ok, Thanks for you help guys! Worked fine Quote Link to comment https://forums.phpfreaks.com/topic/172859-simple-syntax-error/#findComment-911081 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.