Hi,
I'm trying to catch Submit button event on my ruby, CGI script, all theory says that I should have name="mybutton" for this , but in my case I have form like below, without any Name parameter.
I also don't see the <name> on my form, should it be there ? How I can refer this entered fields on this form in my script?
How I can catch if Submit button has been pressed? Or value for user_name or email being entered? I put some dummy check on the top of script for now, so far no matter what I tried nothing helped.
Thanks
Dai
I'm trying to catch Submit button event on my ruby, CGI script, all theory says that I should have name="mybutton" for this , but in my case I have form like below, without any Name parameter.
I also don't see the <name> on my form, should it be there ? How I can refer this entered fields on this form in my script?
How I can catch if Submit button has been pressed? Or value for user_name or email being entered? I put some dummy check on the top of script for now, so far no matter what I tried nothing helped.
Thanks
Dai
Code:
#!/usr/local/bin/ruby
email="vvvv@ryba.com" ### dummy for test
if 1 > 2 #cgi.params['email'].emptyi? ###???????
msg1 = "Please enter info correctly"
msg2 = ""
else
msg1 = "Welcome username"
msg2 = "Can we send email to you at: #{email}"
end
puts "Content-type: text/html"
puts "Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux) # Server information "
puts
puts <<HTML
<!DOCTYPE html>
<html>
<head>
<title>A First Ruby CGI Script</title>
<style type="text/css">
body {background-color:#111;color:#aff;font-family:Helvetica,Arial,Verdana,sans-serif;font-size:12px;}
h1 {color:#aaa}
</style>
</head>
<body>
<h1>This is a form!</h1>
<br> <br>
<form action="" method="post" accept-charset="utf-8">
<p>
<label for="email" style="width:100px;float:left">Email</label>
<input type="text" name="email" value="" id="email">
</p>
<p>
<input type="submit" value="Continue →">
</p>
</form>
<br>
<br> #{msg1}
<br> #{msg2}
<br>
</body>
</html>
HTML