Last active
August 29, 2015 14:25
-
-
Save ms2sato/d2d946eb840e42d16f8b to your computer and use it in GitHub Desktop.
Sinatraでformを使ってPOSTしてみる ref: http://qiita.com/ms2sato/items/901d8c5ca77c1133522c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<p> | |
<a href="about">このサービスについて</a> | |
</p> | |
<h1>お問い合わせ</h1> | |
<form action="confirm" method="POST"> | |
<div> | |
email:<input type="text" name="email" value=""> | |
</div> | |
<div> | |
本文: | |
<textarea name="message" rows="5"></textarea> | |
</div> | |
<div> | |
<input type="submit" value="送信する"> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'sinatra/reloader' | |
get '/' do | |
erb :index | |
end | |
get '/about' do | |
erb :about | |
end | |
post '/confirm' do | |
@email = params[:email] | |
@message = params[:message] | |
erb :confirm | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<h1>お問い合わせ内容確認</h1> | |
<div> | |
<div> | |
email: <%=@email%> | |
</div> | |
<div> | |
本文: | |
<p> | |
<%=@message%> | |
</p> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment