954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Text Fields

0
By helloadam on Dec 28th, 2004 4:34 am

Text fields are used when you want the user to type letters, numbers, etc. in a form. Here is a HTML code that will let user type in there First and Last names in a text field!

Add this code to your template

<form>
First name: 
<input type="text" name="firstname">
<br>
Last name: 
<input type="text" name="lastname">
</form>

Of course, there will also need to be a submit button of some kind, to handle the data input.

cscgal
The Queen of DaniWeb
Administrator
19,437 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 231
 

I need the next step. Can you tell me how to do it. Thanks.

pamwynne
Newbie Poster
7 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

ya exactly what will do the work but yoy can also add radiop buttons and check boxes and a pklace to putin ys password too

anastacia
Junior Poster
142 posts since Nov 2004
Reputation Points: 11
Solved Threads: 1
 

Something like this:



Then, to process the input: (this is with PHP, I'm pretty sure you can find a JavaScript to do this if you don't have a PHP host)

Your name is <?php echo $_POST["firstname"]; echo $_POST["lastname"]; ?>

You selected <?php echo $_POST["groupname"]; ?>

<?php
$checked = isset($_POST["name"]);
if (checked)
echo "You checked the box";
else
echo "You didn't check the box";
?>

You entered <?php echo $_POST["password"]; ?> as your password

mmiikkee12
Posting Whiz in Training
274 posts since Oct 2004
Reputation Points: 17
Solved Threads: 5
 

Naturally, I forgot the submit button...
Right before the tag, add this:

mmiikkee12
Posting Whiz in Training
274 posts since Oct 2004
Reputation Points: 17
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You