Jump to: navigation, search

PHP HTML TextBox

From w3cyberlearnings

Contents

PHP works with HTML Input Text

HTML input tag with the type text is for single line input text.

Syntax input

<input type="text" name="name" value="the value" size="33" maxlength="33" />

Example 1

<?php
if ($_POST) {
	foreach ($_POST as $name => $value) {
		echo $name . '=' . $value . '<br/>';
	}
}
?>
<html>
<head>
<title>Text Input</title>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<table>
	<tr>
		<td>Name</td>
		<td><input type="text" name="name" size="19" maxlength="20"/></td>
	</tr>
	<tr>
		<td>Age</td>
		<td><input type="text" name="age" size="3" maxlength="3" value="5"/></td>
	</tr>
	<tr>
		<td>Address-1</td>
		<td><input type="text" name="address1" size="19" maxlength="25"/></td>
	</tr>
	<tr>
		<td>Address-2</td>
		<td><input type="text" name="address2" size="19" maxlength="25"/></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" name="checkout"/></td>
	</tr>
</table>
</form>
</body>
</html>

Output

Php form textbox 1.png


Related Links


  1. HTML POST
  2. HTML GET
  3. HTML Textarea
  1. HTML Hidden Field
  2. HiddenField Multiple Pages
  3. HTML Password
  1. HTML Textbox
  2. HTML Checkbox
  3. HTML Radio
  1. Drop down list
  2. Pass value uses URL
  3. Pass value uses URL 2.
  4. Multiple Submit Buttons
Navigation
Web
SQL
MISC
References