Skip to content

Instantly share code, notes, and snippets.

@davidmead
Forked from jgmac1106/guestbook.html
Created February 19, 2019 21:26
Show Gist options
  • Save davidmead/3bee8dd47a79f684f774d4e2f54e18a6 to your computer and use it in GitHub Desktop.
Save davidmead/3bee8dd47a79f684f774d4e2f54e18a6 to your computer and use it in GitHub Desktop.
Simple Guestbook for your Website
<!DOCTYPE html>
<html>
<head>
<title>INTERTEXTrEVOLUTION</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/reset.css">
<link rel="stylesheet" href="/styles.css">
<style>
label {display: block;}
</style>
</head>
<body>
<header>
<a href="index.html">
<h1 class="leading leading-bigtext">INTERTEXTrEVOLUTION</h1>
<p class="bigtext">Make.Hack.Play.Learn</p>
</a>
<nav>
<ul>
<li class="1"><a title="" class="navLinks" href="aboutme.html">About</a></li>
<li class="2"><a title="" class="navLinks" href="https://quickthoughts.jgregorymcverry.com">Blog</a></li>
<li class="3"><a title="" class="navLinks" href="articles.html" rel="feed">Articles</a></li>
<li class="4"><a title="" class="navLinks" href="resume.html">Vita</a></li>
<li class="5"><a title="" class="navLinks" href="https://consulting.jgregorymcverry.com/">Consulting</a></li>
<li class="6"><a title="" class="navLinks" href="#reading">Podcasts</a></li>
<li class="7"><a title="" class="navLinks" href="following.html">Following</a></li>
<li class="8"><a title="" class="navLinks" href="annotations.html">Annotations</a></li>
</ul>
</nav>
</header>
<main>
<form action="guestbook.php" method="POST">
<h2>Sign our Guestbook</h2>
<p>* = required fields</p>
<fieldset>
<legend>About you</legend>
<p>
<label for="name">Your name<sup>*</sup></label>
<input type="text" id="name" required>
</p>
<p>
<label for="website">Your website</label>
<input type="text" id="website">
</p>
<p>
<label for="instagram">Instagram</label>
<input type="text" id="instagram">
</p>
<p>
<label for="twitter">Twitter</label>
<input type="text" id="twitter">
</p>
<p>
<label for="email">Email Address<sup>*</sup></label>
<input type="text" id="email" required>
</p>
</fieldset>
<fieldset>
<legend>Your comment</legend>
<p>
<label for="topic">Topic<sup>*</sup></label>
<input type="text" id="topic" required>
</p>
<p class="full-width">
<label for="message">Write your message<sup>*</sup></label>
<textarea name="" id="message" cols="30" rows="7" required></textarea>
</p>
</fieldset>
<p class="full-width">
<button type="submit">Send</button>
</p>
</form>
</main>
</body>
<footer><p><small><a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.</small></p>
</footer>
</html>
<main>
<?php
$con = mysql_connect("bikinikill.reclaimhosting.com","Insert Password","Insert Password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("jgmac1106_guestbook", $con);
$sql="INSERT INTO jgmac1106_guestbook (name, website, instagram, twitter, email, topic, message)
VALUES
('$_POST[name]','$_POST[website]','$_POST[instagram]','$_POST[twitter]','$_POST[email]','$_POST[topic]','$_POST[message]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Thanks for sigining my Guestbook!!";
mysql_close($con)
?>
</main>
<section class="h-feed">
<header>
<h1 class="p-name">My Guestbook</h1>
<p>Curated by <span class="p-author">{blog owners name}</span></p>
</header>
<ul>
<li>
<article class="h-entry">
<header>
<h2 class="p-summary">{topic would appear here}<?php echo htmlspecialchars($_POST['topic']); ?></h2>
</header>
<p class="e-content">{comment would appear here}<?php echo htmlspecialchars($_POST['message']); ?></p>
<div class="h-card">
<p>From <span class="p-author">{commentor}<?php echo htmlspecialchars($_POST['name']); ?></span></p>
<ul>
<li><a class="u-url" href="https://<?php echo htmlspecialchars($_POST['wesbite']); ?>">{website}<?php echo htmlspecialchars($_POST['website']); ?></a></li>
<li><a class="u-url" href="https://instagram/<?php echo htmlspecialchars($_POST['intagram']);">{instagram}<?php echo htmlspecialchars($_POST['instagram']); ?></a></li>
<li><a class="u-url" href="https://twitter/<?php echo htmlspecialchars($_POST['twitter']);">{twitter}<?php echo htmlspecialchars($_POST['twitter']); ?></a></li>
</ul>
</div>
<footer>
<p>Published <time class="dt-published" datetime="yyyy-mm-dd hh:mm:ss">{date/time}<?php $currentDateTime = date('Y-m-d H:i:s'); echo $currentDateTime;?></time></p>
</footer>
</article>
</li>
<li>
<article class="h-entry">
<header>
<h2 class="p-summary">{topic would appear here}<?php echo htmlspecialchars($_POST['topic']); ?></h2>
</header>
<p class="e-content">{comment would appear here}<?php echo htmlspecialchars($_POST['name']); ?></p>
<div class="h-card">
<p>From <span class="p-author">{commentor}<?php echo htmlspecialchars($_POST['name']); ?></span></p>
<ul>
<li><a class="u-url" href="https://<?php echo htmlspecialchars($_POST['wesbite']); ?>">{website}<?php echo htmlspecialchars($_POST['website']); ?></a></li>
<li><a class="u-url" href="https://instagram/<?php echo htmlspecialchars($_POST['intagram']);">{instagram}<?php echo htmlspecialchars($_POST['instagram']); ?></a></li>
<li><a class="u-url" href="https://twitter/<?php echo htmlspecialchars($_POST['twitter']);">{twitter}<?php echo htmlspecialchars($_POST['twitter']); ?></a></li>
</ul>
</div>
<footer>
<p>Published <time class="dt-published" datetime="yyyy-mm-dd hh:mm:ss">{date/time}<?php $currentDateTime = date('Y-m-d H:i:s'); echo $currentDateTime;?></time></p>
</footer>
</article>
</li>
</ul>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment