$myVal = $myFormOrQSitem;
?>
<!-- ASP.NET example -->
<html>
<script language="VB" runat=server>
Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
Message.Text = "Hello " & Name.Text
End Sub
</script>
<body>
<form action="action.aspx" method="post" runat="server">
Name: <asp:textbox id="Name" runat="server"/>
<asp:button text="OK" OnClick="SubmitBtn_Click"
runat="server"/>
<asp:label id="Message" runat="server"/>
</form>
</body>
</html>
字符串连接(String Concatenation)
PHP似乎对此问题给予了足够的重视,它允许将变量插入到字符串中而无需考虑通常的串连(Concatenation)问题。ASP.NET则把整个过程弄得比较麻烦,需要借助其StringBuilder类,但由此ASP.NET的运行速度也会快很多。
<?
// PHP Example
$link = mysql_connect("host", "user", "password")or die("mysql_error());
mysql_select_db("database") or die("Could not select database");
$query = "SELECT * FROM Table";
$result = mysql_query($query) or die(mysql_error());
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
foreach ($line as $col_value) {
//do something
}
}
?>
<