Html: Difference between revisions

From 太極
Jump to navigation Jump to search
Line 60: Line 60:
</html>
</html>
</pre>
</pre>
| <pre>
|  
<html>
<html>
<body>
<body>


Welcome <?php echo $_POST["fname"]; ?>!<br />
Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.
You are <?php echo $_POST["age"]; ?> years old.


</body>
</body>
</html>
</html>
</pre>
|}
|}


== CGI/Perl ==
== CGI/Perl ==

Revision as of 14:48, 16 November 2012

Some useful HTML tags about form

http://www.w3schools.com/html/html_forms.asp

form

<form action="demo_form.asp">
First name: <input type="text" name="FirstName" value="Mickey"><br>
Last name: <input type="text" name="LastName" value="Mouse"><br>
<input type="submit" value="Submit">
</form>

radio button label and input

<form action="demo_form.asp">
  <label for="male">Male</label>
  <input type="radio" name="sex" id="male" value="male"><br>
  <label for="female">Female</label>
  <input type="radio" name="sex" id="female" value="female"><br>
  <input type="submit" value="Submit">
</form>

dropdown list select and option

<select>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>

div

<div style="color:#0000FF">
  <h3>This is a heading in a div element</h3>
  <p>This is some text in a div element.</p>
</div>

PHP

Comparison table
# index.php welcome.php
1.
<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>

</body>
</html>
<html>
<body>
Welcome <?php echo $_POST["fname"]; ?>!
You are <?php echo $_POST["age"]; ?> years old.
</body>
</html>

CGI/Perl