输入html标签在php中没有正确解析[重复]

Possible Duplicate:
Parse error: syntax error, unexpected T_STRING 59

I have a database with names that I would like displayed in the form of a table with checkboxes. Everything works until I try to place the html tag into my php code. When I put the input tag in it gives me the error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

I can't see where I would put a comma or semi colon.

<form>
    <?php
    $name = $_POST['name'];

    $host = "mysql16.000webhost.com";
    $user_name = "a1611480_akaash";
    $pwd = "****";
    $database_name = "a1611480_akaash";
    $db = mysql_connect($host, $user_name, $pwd);

    mysql_select_db($database_name);

    $result = mysql_query("SELECT name FROM Sort");

    $var = array();
    while ($row = mysql_fetch_array($result)) {
        $var[] = $row['name'];
    }

    $unique = array_unique($var);

    foreach ($unique as $value) {

        echo "<p class = Body_text><label>$value</label> <input type="checkbox" name="name" value="$value" /> </p>
";
    }
    ?>
</form>

Replace this:

echo "<p class = Body_text><label>$value</label> <input type="checkbox" name="name" value="$value" /> </p>
"

with this:

echo <<<EOD
<p class = Body_text><label>$value</label> <input type="checkbox" name="name" value="$value" /> </p>
EOD;

... This uses HEREDOC syntax, which easily bypasses most of your quotation issues. However, it comes with an important caveat: the line EOD; must not be indented and there cannot be anything else on that line (such as trailing spaces).

On your echo line, the entire thing must be surrounded by double quotes. You open the double quotes before checkbox so it is seeing checkbox as an unknown PHP call. Use a combination of single and double quotes.

Replace the "echo" line with

echo "<p class = Body_text><label>$value</label> <input type='checkbox' name='name' value='$value' /> </p>
";

Because you use double quotes as a string delimiter and also for the checkbox itself, it kinda breaks out of the php string.

change this line.. u have to escape doublequotes

echo "<p class = Body_text><label>$value</label> <input type=\"checkbox\" name=\"name\" value=\"$value\" /> </p>
";

You need to escape your backslashes, or perhaps use heredoc syntax. See below for a couple of examples where you're breaking your PHP code:

echo "<p class = Body_text><label>$value</label> <input type="checkbox" name="name" value="$value" /> </p>
";
                                                            ^^^      ^^^