| | |
Text Fields
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
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
Add this code to your template
<form> First name: <input type="text" name="firstname"> <br> Last name: <input type="text" name="lastname"> </form>
0
•
•
•
•
Of course, there will also need to be a submit button of some kind, to handle the data input.
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
0
•
•
•
•
Something like this:
<form method="post" action="the_php_page.php">
<!-- a pair of radio buttons -->
<!-- if they have the same name, they're in the same group -->
<input type="radio" name="groupname" value="Option A">
<input type="radio" name="groupname" value="Option B">
<!-- a check box -->
<input type="checkbox" name="cb1" value="A Checkbox">
<!-- a password box -->
<input type="password" name="password">
</form>
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"]; ?><br>
You selected <?php echo $_POST["groupname"]; ?><br>
<!-- one of my favorite PHP tricks: -->
<?php
$checked = isset($_POST["name"]);
if (checked)
echo "You checked the box";
else
echo "You didn't check the box";
?>
<!-- wouldn't normally say this, but it's just a demo -->
You entered <?php echo $_POST["password"]; ?> as your password
<form method="post" action="the_php_page.php">
<!-- a pair of radio buttons -->
<!-- if they have the same name, they're in the same group -->
<input type="radio" name="groupname" value="Option A">
<input type="radio" name="groupname" value="Option B">
<!-- a check box -->
<input type="checkbox" name="cb1" value="A Checkbox">
<!-- a password box -->
<input type="password" name="password">
</form>
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"]; ?><br>
You selected <?php echo $_POST["groupname"]; ?><br>
<!-- one of my favorite PHP tricks: -->
<?php
$checked = isset($_POST["name"]);
if (checked)
echo "You checked the box";
else
echo "You didn't check the box";
?>
<!-- wouldn't normally say this, but it's just a demo -->
You entered <?php echo $_POST["password"]; ?> as your password
Similar Threads
- preformatted text fields...? (JavaScript / DHTML / AJAX)
- I need a script or applet, to insert text into text fields in different websites. (JavaScript / DHTML / AJAX)
- text fields (Site Layout and Usability)
- Resizing text fields (JavaScript / DHTML / AJAX)
- text fields in DW (Graphics and Multimedia)
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 xml xsl



