Input html tag not parsing properly in php

Posted by Akaash on Stack Overflow See other posts from Stack Overflow or by Akaash
Published on 2012-11-13T22:53:04Z Indexed on 2012/11/13 22:59 UTC
Read the original article Hit count: 158

Filed under:
|
|

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>\n";
    }
    ?>
</form>

© Stack Overflow or respective owner

Related posts about php

Related posts about html