Ver el resultado de las variables php en el html

Como se hace el llamado de la variable en el html y poderver el resultado

2 Respuestas

Respuesta
1

En html puedes insertar código PHP...

¿

¿
<?php
echo $variable;
?>

simple...

Respuesta
1

Si esto esta bien, le adjunte donde planteó la variable para que me revise porque no me sale bien

Gracias pero no se como hacer esto en este código, quiero saber como plantear esta variable y ver el resultado en el html que esta abajo. Los datos php y html los puse en negrita.

<?php require_once('Connections/prueba_conecciones.php');?>
<?php
$opcion = 'A la Venta';
if($opcion == 'A la Venta') {
echo 'vendido';
} else {
echo 'No hay vta';
}
echo"<br>";
echo"<br>";
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$maxRows_Recordset1 = 23;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_prueba_conecciones, $prueba_conecciones);
$query_Recordset1 = "SELECT titulo, opcion FROM imagen";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $prueba_conecciones) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<! Doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sin título</title>
</head>
<body>
<table width="200" border="1">
  <tbody>
      <?php do {?><tr>
        <td><?php echo $row_Recordset1['titulo'];?></td>
        <td><?php echo $row_Recordset1['opcion'];?></td>
        <td><?php echo $opcion;?></td>
        <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));?>
    </tr>
  </tbody>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas