I got an html form where I put values and insert them into the database. but when I insert them the values appear in the db like "".
This is how I insert the values:
title, author, description := r.Form("title"), r.FormValue("author"), r.FormValue("description")
fmt.Println(title, author, description)
rows, err := db.Query("INSERT INTO apps (title, author, description) VALUES ($1, $2, $3)",
title, author, description)
PanicIf(err)
defer rows.Close()
http.Redirect(w, r, "/myapps", http.StatusFound)
db.Close()
Html :
<form action="/apps" method="POST">
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" name="title" />
</div>
<div class="form-group">
<label>Author</label>
<input type="text" class="form-control" name="author" />
</div>
<div class="form-group">
<label>Description</label>
<input type="text" class="form-control" name="description" />
</div>
<input type="submit" value="Create" class="btn btn-success" />
<a href="/myapps">
<input type="button" value="Return" class="btn btn-primary" />
</a>
</form>
There is maybe something wrong with the formvalues?