Revision: 40717
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 6, 2011 03:09 by AzNGTX2
Initial Code
<?php //mysql database connection $dbhost='Database Host'; $dbuser='Your Username'; $dbpass='Your Password'; $dbtable='Your Table Name'; mysql_connect("$dbhost", "$dbuser", "$dbpass") or die("Could not connect."); mysql_select_db("$dbtable") or die("Table could not be selected."); //Submit Form if(isset($_POST['submit'])) { $yourpost=$_POST['yourpost']; if(strlen($yourpost)<1) { print "You did not enter a message."; //no post entered }else{ $displaytime=date("F j, Y, g:i A"); //SQL Queries $insertpost="INSERT INTO kyproject_blog(message, date) values('$yourpost','$displaytime')"; mysql_query($insertpost) or die("Could not insert post"); //insert post print "Blog entry added. Return to the <a href='index.php'>index page</a>."; } }else{ print "<fieldset> <form action='' method='post' id='ticketform'> <p><label>Blog Entry:</label> <textarea cols='50' rows='11' name='yourpost' id='message' class='bbeditor'></textarea></p> <p><input name='submit' class='formbutton' value='Submit' type='submit' /></p> </form>"; } print "</td></tr></tbody></table> </fieldset>"; ?>
Initial URL
Initial Description
Initial Title
PHP Blog: Insert.php
Initial Tags
Initial Language
PHP