Skip to content

Instantly share code, notes, and snippets.

@joshuakfarrar
Last active March 15, 2022 09:30
Show Gist options
  • Save joshuakfarrar/636b938ad086b8d3f0e20216b1727912 to your computer and use it in GitHub Desktop.
Save joshuakfarrar/636b938ad086b8d3f0e20216b1727912 to your computer and use it in GitHub Desktop.
para vladimiro.
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
};
$template = <<<EOD
<html>
<head>
<title>web thing</title>
</head>
<body>%s</body>
</html>
EOD;
$forma = <<<EOD
<form method="post">
</form>
EOD;
function render_page($post) {
if (!empty($post)) { // procesa la pagina
return sprintf($template, "Entry successfully recorded!");
} else { // mostrar la forma
return sprintf($template, $forma);
}
};
echo render_page($_POST);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment