Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

My php code

By: a guest on Jun 7th, 2012  |  syntax: PHP  |  size: 0.58 KB  |  views: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.         get_header();
  3.  
  4.         $name = $_POST['txtName'];
  5.         $message = $_POST['message'];
  6.  
  7.         if (!empty($name) && !empty($message)){
  8.                 global $wpdb;
  9.                 $query = "INSERT INTO message (username, message) values ('$name', '$message');";
  10.  
  11.                 $result = $wpdb->query($query);
  12.         }
  13. ?>
  14. <body>
  15. <form name="frm" method="post" action="<?php bloginfo('url'); ?>/message/">
  16.         Enter name : <input name="txtName" type="text"> <br />
  17.         <br />
  18.         Enter message : <textarea name="message" cols="40" rows="10"></textarea><br />
  19.         <input type="submit" value="Submit" />
  20. </form>
  21.  
  22. </body>
  23. <?php get_footer(); ?>