出来るのだASP Q&A掲示板(過去LOG)  訪問数 52046 昨日 889 今日 776
    【PR】 パソコン入門からIT専門書まで幅広く取り揃えています。セブン-イレブン受取り手数料無料のセブンアンドワイ。
Topに戻る 掲示板に戻る 検索 削除 管理者

配列   Hashimotoさん [2002/07/04 14:03:35] [2267]
  Re:配列   banbanさん [2002/07/04 15:32:36] [2269]
  配列添字下限は1?   北岳さん [2002/07/04 16:25:07] [2271]

[2267] 配列
投稿者:Hashimotoさん 2002/07/04 14:03:35
はじめまして!
ASP四日目のHashimotoです。

@
<%
a=Request.Form("Index")
Response.Write Request.Form("kennsuu1(a)")
%>

@のように配列の中にRequest.Formで取得した値を入れてみたところ、値を取得することが出来ませんでした。

検証のため
<%=a%>及び<%=Request.Form("kennsuu1(0)")%>を実行したところ、
値を取得することが出来ました。

どのように@を記載すれば、値が取得できるでしょうか?

よろしくお願いします。

[2269] Re:配列
投稿者:banbanさん 2002/07/04 15:32:36
a=Request.Form("Index")
Response.Write Request.Form("kennsuu1(" & a & ")")
こういうことなのかな?

[2271] 配列添字下限は1?
投稿者:北岳さん 2002/07/04 16:25:07
Cint関数でaを整数型にして下さい。
例:formの中から自分を呼び出しています。
(あれ、配列の添字を0〜2にするとエラー。下限を1にすると正常動作しますが、何か奇妙な・・・)

--------------1.asp-------------
<html><body>
<%
n=request.form("kensu1").count
if n=3 then
a=cint(Request.Form("Index"))
if a>0 and a<4 then
x1=request.form("kensu1")(1)
x2=request.form("kensu1")(2)
x3=request.form("kensu1")(3)
Response.Write "<br><b><font size=+3>" & Request.Form("kensu1")(a) & "</font></b>"
else
Response.Write "<br>INDEXは1〜3の間です。"
end if
else
a=1
end if
%>
<form action="1.asp" method="post">
<p>1.<input type="text" size=20 name="kensu1" value="<%= x1 %>">
<br>2.<input type="text" size=20 name="kensu1" value="<%= x2 %>">
<br>3.<input type="text" size=20 name="kensu1" value="<%= x3 %>">
<p>INDEX:<input type="text" name="Index" size=5 value="<%= a %>">
<p><input type="submit" value="GO">
</form></body></html>



TreeBBS For ASP V.0.1.3
Program By YasNet