Syntax error including the tag? php? in HTML [closed]

1
<select id="user_type" name="user_type">
    <option value="0">Select an user type</option>
    <?php while($row = $result->fetch_assoc()){ ?>
        <option value="<?php echo $row['id']; ?>"><?php echo $row['type']; ?></option>
    <?php }?>
</select>

Do not swallow the quotes on line 4 and I do not know why ...

    
asked by Cifu 14.01.2017 в 03:07
source

2 answers

1

I've already seen where the bug is, the first problem was that I did not have the require where those variables were so I could not get to perform the functions of that code, the second is that within that file I had to a location so I did not load the file well and redirected badly. Thanks for the contributions:)

    
answered by 14.01.2017 / 10:14
source
-1

Is not this what you're looking for?

<select id="user_type" name="user_type">
    <option value="0">Select an user type</option>
    <?php while($row = $result->fetch_assoc()){ ?>
        <option value="<?php print "$row[id]"; ?>"><?php print "$row[type]"; ?></option>
    <?php }?>
</select>

Note that you can also substitute the id and type with the number of the select to remove the apostrophes.

    
answered by 14.01.2017 в 05:53