1

i have been searching for about 40 minutes now for a way to make "Enter" send text but nothing seems to be working with my code, i tried alot of differend type of jquery codes and functions but nothing seemed to work.i will admitt i am not the best at Web Programing but im doing my best to educate myself more then i do at school. Here is my code, it should include everything needed to help me solve my problem. Thanks in advance.

  <?php
  session_start();
  if((!isset($_SESSION[ "usrname" ]) || $_SESSION[ "usrname" ] == "")||(!isset($_SESSION[ "color" ]) || $_SESSION[ "color" ] == "")) {
    ?>
<html>
  <head>
    <title>Chat Room Example</title>
    <link rel="stylesheet" href="../css/main.css" />
  </head>
  <body>
    <h1>Please choose a nickname and a color</h1>
    <form action="../worker/login.php" method="post">
      <table cellpadding="5" cellspacing="0" border="0">
        <tr>
          <td align="left" valign="top">Nickname :</td>
          <td align="left" valign="top">
            <input type="text" name="usrname" maxlength="15" />
          </td>
        </tr>
        <tr>
          <td align="left" valign="top">Color :</td>
          <td align="left" valign="top">
            <select name="color">
              <option value="000000">Black</option>
              <option value="000080">Navy</option>
              <option value="800080">Purple</option>
              <option value="00FFFF">Aqua</option>
              <option value="FFFF00">Yellow</option>
              <option value="008080">Teal</option>
              <option value="A52A2A">Brown</option>
              <option value="FFA500">Orange</option>
              <option value="CCCCCC">Gray</option>
              <option value="0000FF">Blue</option>
              <option value="00FF00">Green</option>
              <option value="FF00FF">Magenta</option>
              <option value="FF0000">Red</option>
            </select>
          </td>
        </tr>
        <tr>
          <td align="left" valign="top"></td>
          <td align="left" valign="top"><input type="submit" value="Login" /></td>
        </tr>
      </table>
    </form>
  </body>
</html>
    <?php
  }else{  ?>
<html>
  <head>
    <title>Chat Room Example</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>     
    <script src="../worker/main.js"></script>
    <link rel="stylesheet" href="../css/main.css" />
  </head>
  <body>
    <div id="view_ajax"></div>
    <div id="ajaxForm">
      <input type="text" id="chatInput" /><input type="button" value="Send" id="btnSend" />
    </div>
  </body>
</html>
<?php }?>
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
  • https://stackoverflow.com/questions/699065/submitting-a-form-on-enter-with-jquery – Bardicer Sep 26 '17 at 15:56
  • We are always glad to help and support new coders but ***you need to help yourself first. :-)*** After [**doing more research**](https://meta.stackoverflow.com/q/261592/1011527) if you have a problem **post what you've tried** with a **clear explanation of what isn't working** and provide [a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). Read [How to Ask](http://stackoverflow.com/help/how-to-ask) a good question. Be sure to [take the tour](http://stackoverflow.com/tour) and read [this](https://meta.stackoverflow.com/q/347937/1011527). – Jay Blanchard Sep 26 '17 at 16:47

0 Answers0