title: I want to send message using enter key and new line using shift+enter key for my chat system
body: <pre><code> &lt;?php
   session_start();
   if(!isset($_SESSION['user_id']) &amp;&amp; empty($_SESSION['user_id'])){
      header("Location:login.php");
   }
   include 'connect.php';
   include 'functions.php';
   $my_id = $_SESSION['user_id'];
   $hash = $_GET['hash'];
   if(isset($_POST['message']) &amp;&amp; !empty($_POST['message'])){
   $new_message = $_POST['message'];
   mysql_query("INSERT INTO `messages`       VALUES('','$hash','$my_id','$new_message')");
   header('Location: startcon.php?hash='.$hash);
   }
   ?&gt;
   &lt;link rel='stylesheet' href='css.css' /&gt;
   &lt;header&gt;
   &lt;div id="logo"&gt;&lt;img src="logo.jpg" height="35px" width="35px"&gt;&lt;/div&gt;
   &lt;div id="options"&gt;&lt;a href='profile.php'&gt;Profile&lt;/a&gt;&amp;nbsp &amp;nbsp &lt;a      href="conversation.php"&gt;Messenger&lt;/a&gt; &amp;nbsp &amp;nbsp &lt;a href="friends.php"&gt;Friends&lt;/a&gt; &amp;nbsp &amp;nbsp &lt;a href="requests.php"&gt;Friend     Requests&lt;/a&gt; &amp;nbsp &amp;nbsp &lt;a href='find.php'&gt;Find Friends&lt;/a&gt; &amp;nbsp &amp;nbsp &lt;a     href='logout.php'&gt;Logout&lt;/a&gt; &amp;nbsp &lt;/div&gt;
   &lt;/header&gt;
   &lt;div id='outerconversation'&gt;
   &lt;div id="conversationheader"&gt;&lt;a href='conversation.php' title='back'&gt;&lt;img     src='back.png' height='20px' width='18px' /&gt;&lt;/a&gt;&lt;/div&gt;
   &lt;div id="innerconversations"&gt;
   &lt;?php
   $message_query = mysql_query("SELECT from_id, message FROM `messages` WHERE      `group_hash`='$hash'");
   while($run_message = mysql_fetch_array($message_query)){
   $from_id = $run_message['from_id'];
   $message = $run_message['message'];
   $user_query = mysql_query("SELECT `email`,`username` FROM `users` WHERE      id='$from_id'");
   $run_user = mysql_fetch_array($user_query);
   $from_email = $run_user['email'];
   $from_username = $run_user['username'];
   echo "&lt;hr color='#008298' /&gt;&lt;span style='color: #008298; font-family:      Arial; margin-left: 10px;'&gt;$from_username &lt;span style='color: #BAB9B9; font-     style: italic;'&gt;$from_email&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;";
   echo "&lt;span style='color: #008298; font-family: Segoe UI Light; margin-     left: 30px;'&gt;&lt;span style='color: #BAB9B9; font-family: Arial; margin-left:      10px;'&gt;says: &lt;/span&gt;$message&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;";
  }
  ?&gt;
   &lt;/div&gt;
   &lt;form method='POST'&gt;
   &lt;?php
   ?&gt;
   &lt;textarea name='message' placeholder="Type Message..." maxlength="400"      rows='6' cols='145'&gt;&lt;/textarea&gt;
   &lt;input type='submit' value="Send Message" /&gt;
   &lt;/form&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>I am making a chat system. I want to send message using ENTER key instead of input submit button and New line using Shift+Enter. I don't have strong knowledge of javascript and jquery. Please make a function that sends message using enter key and make new line using shift+enter key.</p>