CGICookieName()

Syntax

Result$ = CGICookieName(Index)
Description
Returns the name of the specified cookie.

Parameters

Index The index of the cookie to get the name. The first index value starts from 0. To get the number of available cookie, use CountCGICookies().

Return value

Returns the name of the specified cookie.

Example

  If Not InitCGI() Or Not ReadCGI()
    End
  EndIf
  
  WriteCGIHeader(#PB_CGI_HeaderContentType, "text/html") ; Write the headers to inform the browser of the content format
  WriteCGIHeader(#PB_CGI_HeaderSetCookie  , "mycookie=hello", #PB_CGI_LastHeader) ; Write one cookie named 'mycookie'
  
  WriteCGIString("<html><title>PureBasic - cookies</title><body>" +
                 "NbCookies: " + CountCGICookies() + "<br><br>")

  ; List the all cookies and display their name and value
  ;
  For k = 0 To CountCGICookies()-1 
    WriteCGIString(CGICookieName(k)+": " + CGICookieValue(CGICookieName(k)) + "<br>")
  Next
    
  WriteCGIString("</body></html>")

See Also

CountCGICookies(), CGICookieValue()

Supported OS

All

<- CGIBuffer() - CGI Index - CGICookieValue() ->