SHARE
TWEET

My php code

a guest Jun 7th, 2012 39 Never
  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(); ?>
RAW Paste Data
Top