Request.Form - Page 8
August 7,2002
On the same page, create a horizontal rule underneath the
querystring link and form, and then insert the following code:
<form name="form1" method="post" action="create_request_variables.asp">
username: <input name="username" type="text"
id="username" /><br />
password: <input name="user_pwd" type="password" id="user_pwd" /> <br />
<input type="submit" name="Submit" value="Submit"
/>
</form>
Now select Bindings, then Request Variables. In the pop-up box that appears,
select Request.Form from the
Type menu and type username in the Name field. Click OK. You will then see the
username variable listed under Request
in the Bindings window. Follow the
same steps to also add the user_pwd form field and it will be added to the Request list.
As with the other variables, you can now call these variables
to anywhere you want in your page by dragging and dropping them from the Bindings
window into your code. When you enter values into your form and Submit it, the values will appear wherever
you placed the variables.
Request.Cookie
On the same page, insert a horizontal rule below the form
you just created. In Code View add the following code above the opening <html> tag:
<% Response.Cookies("ckSayHello") = "Hello"
%>
In the same manner as we did
before, select Bindings then Request Variables,
choose Request.Cookie from the Type menu, and type ckSayHello in the Name
field. If you now drag and drop the ckSayHello variable underneath the last horizontal
rule you added, and view your page through a browser, the cookie variable
should be displayed as the cookie is created once the page loads.
Request.ServerVariable
On the same page, insert a horizontal rule below the dynamic
cookie variable you just created. In the same manner as before, bring up the
Request Variables pop-up box. Select
Request.ServerVariable from the Type
menu and type remote_host in the Name field. OK this, then we should be able to drag and
drop the remote_host variable from the Bindings
window onto your page. View the page in a browser, and the ServerVariable should be displayed once the page loads.
Session Variables
You can also store session variables in the Bindings window.
Of course we have to create one first. Create a new dynamic ASP web page and
save it as create_session.asp. In Code View add the following code above the opening <html> tag:
<% Session("svSayGoodbye") = "Goodbye" %>
Select Bindings,
then Session Variables. Type svSayGoodbye in the Name field and click
OK. The variable should be listed under a "Session" heading in the Bindings window. Now we can drag and drop the
svSayGoodbye variable onto our page, just
like we did before with our Request Variables – now view the page in a browser,
and the Session Variable should be displayed as the session is created once
the page loads.
The Bindings area is another useful timesaving feature of
Dreamweaver MX – use it as much as you can. It organizes your dynamic variables
and keeps them accessible as you build documents. Another good reason to use
it is that you won't have to remember the names of the dynamic variables after
you have created them! Once you create a dynamic variable, always add it to
the Bindings window for easy access
to its value.
Bindings Page 7
Dynamic Dreamweaver MX
Server Behaviors Page 9
|