Text box


#1

Does anyone how to put a text input box that inputs some text from the user?
I learned HTML but there was no mention of how to put a fancy text input box.


#2

you need to use another language to achieve this . it depends what is your goal, but you should read about php, databases , or javascript.

html does not operates on variables.
at the beginning create the html form ,and pass argument POST in method argument.
if you want to do some additional action from different file AFTER you press the submit button, place the additional file location in action method.

simple html form :smile

< form method="POST" action="" >
< input type="text" name="field" >
< Input type="submit" name="send" value="send" >
</ form>

<?php
if(isset($_POST['send'])){
echo "Hi,".$POST['field'];
}
?>

this code will store the data of input as long as you write something new to it, or you refresh the page. if u want to store it longer , you need to place it somewhere, in a file , database, cookie, whatever...


#3

Ohk! I learnt html completely so I was a bit confused when I saw this code.
Actualy the code I saw was:-

< form name="checkListForm">
< input type="text" name="checkListItem"/>
< /form>
Do u know about it?
Is this php or html?


#4

a form (<form></form>) is html, but you can use jquery to get the value of user input:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>val demo</title>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<input type="text" id="demo"><input type="button" value="click me" id="click">
  <script>
    $('#click').click(function(){
      alert($('#demo').val()); 
    });
  </script>
</body>

this is super simple, i made a button, which if clicked calls a function, which alerts the value from the input text field.


#6

i learnt the html lesson completely but there was no mention of < form> elements or < input>. Did they skip it perhaps??


#7

No, you didn't. There is no mention of it in the html + css track, doesn't mean they don't exist. The html + css course here on CC is just the basics, input and form are no part of it. But since this question was asked in the jquery section, i gave a jquery answer


#8

Thats what i sed, Codeacademy has skiped it in the html+CSS section. Is there any other language where this code is taught in codeacademy?


#9

web form tutorial


#10

Thanks guys I searched it in MDN and got my answers for form and input.
Thanks for the help guys