Escolar Documentos
Profissional Documentos
Cultura Documentos
DOCTYPE html>
<html>
<head>
<title>Visualizar Imóveis</title>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
}
</style>
</head>
<body>
<h1>Imóveis Cadastrados</h1>
<table>
<tr>
<th>Título</th>
<th>Descrição</th>
<th>Preço</th>
</tr>
<?php
// Verifica se o arquivo XML existe
if (file_exists('imovel.xml')) {
// Carrega o arquivo XML
$xml = simplexml_load_file('imovel.xml');
<?php
// Verifica se os dados foram enviados via POST
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Verifica se todos os campos obrigatórios foram preenchidos
if (isset($_POST['titulo']) && isset($_POST['descricao']) &&
isset($_POST['preco'])) {
// Cria uma nova instância do SimpleXMLElement
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?
><imovel></imovel>');
<!DOCTYPE html>
<html>
<head>
<title>Cadastro de Imóveis</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
}
form {
max-width: 400px;
margin: 0 auto;
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 10px;
font-weight: bold;
}
input[type="text"],
input[type="number"],
textarea {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
p.download-link {
text-align: center;
margin-top: 20px;
}
p.download-link a,
p.view-link a {
display: inline-block;
padding: 10px 20px;
background-color: #4CAF50;
color: white;
text-decoration: none;
border-radius: 4px;
}
</style>
</head>
<body>
<h1>Cadastro de Imóveis</h1>
<br>
<label for="descricao">Descrição:</label>
<textarea name="descricao" required></textarea>
<br>
<label for="preco">Preço:</label>
<input type="number" name="preco" required>
<br>
<?php
// Verifica se o arquivo XML existe
if (file_exists('imovel.xml')) {
echo '<p class="download-link"><a href="imovel.xml" download>Baixar
XML</a></p>';
echo '<p class="view-link"><a href="visualizar.php"
target="_blank">Visualizar XML</a></p>';
}
?>
</body>
</html>