Last active
March 15, 2022 09:30
-
-
Save joshuakfarrar/636b938ad086b8d3f0e20216b1727912 to your computer and use it in GitHub Desktop.
para vladimiro.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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