package main

import (
    "net/http"
    "fmt"
)

func loadin(w http.ResponseWriter, r *http.Request) {
    username := r.FormValue("username")
    password := r.FormValue("password")
    fmt.Fprintf(w,"<html><body>");
    fmt.Fprintf(w, "Hello, %s ! <br/>", username)
    fmt.Fprintf(w, "Your password is : %s!", password)
    fmt.Fprintf(w,"</body></html>");
}

func main() {
    http.HandleFunc("/loadin", loadin)
    http.ListenAndServe(":8080", nil)
}

 

<html>
    <body>
        <form action="http://127.0.0.1:8080/loadin" method="get">
            帳號:<input type="text" name="username" />
            <br/>
            密碼:<input type="password" name="password" />
            <br/>
            <br/>
            <input type="submit" value="送出" />
        </form>
    </body>
</html>







    全站熱搜

    黃彥霖 發表在 痞客邦 留言(0) 人氣()