I have this select input that gives me the option to choose a name of all the ones that can be removed:
<td width="50%">
<select class="form-control" id="acro_proyecto" name="acro_proyecto" required>
<option value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('proyecto') : ''; ?>"><?php echo isset($obj_categoria) ? $obj_categoria->__GET('proyecto') : ''; ?> </option>
<?php
$pdo = new PDO('mysql:host=localhost;dbname=dmsgeneratorcode', 'root', '');
$pdo->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
$stmt = $pdo->prepare('Select acro_proyecto from proyectos');
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo '<option>' . $row['acro_proyecto'] . '</option>';
}
?>
</select>
</td>
Now, once you have been chosen, you have to automatically paint the maximum number of times that is automatically entered in the following input:
<td width="50%">
<input class="form-control numerodocumento" type="text" name="num_documento" id="num_documento" value="
<?php
$pdo = new PDO('mysql:host=localhost;dbname=dmsgeneratorcode', 'root', '');
$pdo->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
$stmt = $pdo->prepare('Select MAX(num_documento) from documento where proyecto='echo isset($obj_categoria) ? $obj_categoria->__GET('proyecto') : '';);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo '<option>' . $row['num_documento'] . '</option>';
}
?>" readonly />
</td>
But the line where it collects the value puts it in red like the syntax is wrong and that's obvious. However, I do not know how to put it right so that it collects the data from the field previously introduced. I get this error in the input in the web application:
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ')'