-2

Here is the form:

<form method="post">
       <label class="left margin-left-10">Involve in discussion</label>
       <br>
      <textarea name="chat" placeholder="Write.." cols="20" wrap="soft" maxlength="1000" class="left"></textarea>
      <button name="sendmsg" class="background-none text-white background-primary-hightlight text-s-size-12">Send</button>
<form>
halfer
  • 19,824
  • 17
  • 99
  • 186
  • 2
    Possible duplicate of [How to prevent form from being submitted?](http://stackoverflow.com/questions/3350247/how-to-prevent-form-from-being-submitted) – dsadnick Apr 07 '17 at 21:29
  • Send the form somewhere or submit it via AJAX. Also `
    ` should be `
    ` that is currently opening a second `form`.
    – chris85 Apr 07 '17 at 21:29
  • Doesn't look like it would submit to me, with just a – Hayden Thring Apr 07 '17 at 21:30
  • Is there jquery, javascript, PHP as well? – chris85 Apr 07 '17 at 21:31
  • I am using PHP in back end sorry I missed pasting here.. – Mohammad Aitisam Yaseen Apr 07 '17 at 21:33
  • @HaydenThring The default type of a button in a form is to submit, if undeclared. https://www.w3.org/TR/html401/interact/forms.html#adef-type-BUTTON – chris85 Apr 07 '17 at 21:34
  • What about my question? – Mohammad Aitisam Yaseen Apr 07 '17 at 21:37
  • I addressed that 7 minutes ago. `Send the form somewhere or submit it via AJAX.` – chris85 Apr 07 '17 at 21:37
  • @chris85 thanks i did have that suspicion, what if he used a type button, or but the button outside the form, otherwise there is javascript – Hayden Thring Apr 07 '17 at 21:39
  • 1
    @HaydenThring `type=button` is different than ` – chris85 Apr 07 '17 at 21:42
  • Any clue how to send it with AJAX? – Mohammad Aitisam Yaseen Apr 07 '17 at 21:45
  • Look up ajax jquery docs for that, but you will make it simpler if you avoid that if possible. Just trigger the form submit with javascript, or interact with the form with javascript. You havent really said what you want to do with the form apart from just not submit it normally... – Hayden Thring Apr 07 '17 at 22:22
  • @HaydenThring i am making a message box, in that i am receiving and sending messages. Now coming back to this form I am sending a message which is the value user inputs in – Mohammad Aitisam Yaseen Apr 08 '17 at 08:22
  • Sure, than if you want to submit and receive data without page load/refresh you need ajax, look up the simplified $.get and $.post commands in jquery. – Hayden Thring Apr 08 '17 at 11:42

1 Answers1

0

Make

<button name="sendmsg" class="background-none text-white background-primary-hightlight text-s-size-12">Send</button>

This

<input type="button" value="Send" name="sendmsg" class="background-none text-white background-primary-hightlight text-s-size-12" />
Hayden Thring
  • 1,718
  • 17
  • 25