15

I am very new to PHP and have no idea why this is happening, I have looked at other online items, however I just cannot seem to see why I am getting this error.

<?php
include_once('assets/libs/posicloud/posicloud.php');

    $cloud=new posicloud();
    $out='';
    foreach ($cloud->list_templates() as $key=>$template)
    {
$out.='<option value=''.$key.'">'.$value["name"].';
    }
  return $out;
?>

Thankyou for any help!

RossDoughty
  • 303
  • 1
  • 2
  • 7
  • 1
    Thanks, apologies but I am very new, I have read the error messages but did not understand them, thats why I posted here to see if someone could help me understand my issue. – RossDoughty Nov 26 '12 at 13:30
  • There's something wrong with your quotes notation. As this is a very important aspect of PHP (or programming in general), I recommend reading some more about it first before we give you a bite-sized answer. For example: http://www.trans4mind.com/personal_development/phpTutorial/quotes.htm – Joram van den Boezem Nov 26 '12 at 13:44
  • I was receiving this error and had to convert the file line separators from CF to CRLF. – Enkode Aug 30 '15 at 05:43

5 Answers5

21

When you're working with strings in PHP you'll need to pay special attention to the formation, using " or '

$string = 'Hello, world!';
$string = "Hello, world!";

Both of these are valid, the following is not:

$string = "Hello, world';

You must also note that ' inside of a literal started with " will not end the string, and vice versa. So when you have a string which contains ', it is generally best practice to use double quotation marks.

$string = "It's ok here";

Escaping the string is also an option

$string = 'It\'s ok here too';

More information on this can be found within the documentation

Rawkode
  • 21,990
  • 5
  • 38
  • 45
2

Wrong quoting: (and missing option closing tag xd)

$out.='<option value="'.$key.'">'.$value["name"].'</option>';
aleation
  • 4,796
  • 1
  • 21
  • 35
1
'<option value=''.$key.'">'

should be

'<option value="'.$key.'">'
Luca Rainone
  • 16,138
  • 2
  • 38
  • 52
1

You have a sintax error in your code:

try changing this line

$out.='<option value=''.$key.'">'.$value["name"].';

with

$out.='<option value="'.$key.'">'.$value["name"].'</option>';
0
$out.='<option value="'.$key.'">'.$value["name"];

me funciono con esta

"<a  href='javascript:void(0)' onclick='cargar_datos_cliente(\"$row->DSC_EST\")' class='button micro asignar margin-none'>Editar</a>";
silly
  • 7,789
  • 2
  • 24
  • 37