/ Published in: PHP
Just a simple php insert script.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // Connect to the server:: // Select the database:: { // Set up and clean our variables $sql = "INSERT INTO posts VALUES (NULL,'$title','$body')"; { echo 'Thanks! you have made a post!'; } else { } } ?> <html> <head> <title>Carl's Forum</title> </head> <body> <?php $sql = "SELECT * FROM posts ORDER BY post_id DESC"; ?> <h1><?php echo $row['post_title']; ?></h1> <p><?php echo $row['post_body']; ?></p> <?php endwhile; ?> <form method='post' action='#'> <input type='text' name='post_title' /><br /> <textarea name='post_body' rows='10' cols='50'></textarea><br /> <input type='submit' name='post' value='Post' /> </form> </body> </html>