[fpc-pascal] fpweb tutorial

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Tue Jul 13 17:43:44 CEST 2010


On Tue, Jul 13, 2010 at 5:20 PM, Michael Van Canneyt
<michael at freepascal.org> wrote:
> My mistake, the correct name is 'Queryfields':
>
> Avar:=Request.QueryFields['MyVar'];

Well, that takes an integer as argument, not a string, but I managed
to build my own routine for that. If something like that isn't already
in svn fpweb then it should probably be added:

function TFPWebModule1.GetQueryFieldByName(ARequest: TRequest; AName:
string): string;
var
  i, StrIndex: Integer;
  Str: string;
begin
  for i := 0 to ARequest.QueryFields.Count - 1 do
  begin
    StrIndex := Pos('=', ARequest.QueryFields[i]);
    Str := ARequest.QueryFields[i];
    if Copy(Str, 1, StrIndex - 1) = AName then
    begin
      Result := Copy(Str, StrIndex + 1, Length(Str) - StrIndex);
      Break;
    end;
  end;
end;


-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list