Click to See Complete Forum and Search --> : help with java form


muskokamouse
10-21-2004, 03:07 PM
I am trying to incorporate a form into a site I am developing, but I have never really used Java. Can someone help me???? It is a simple membership form but I have no idea how to tie it all together.

Any help would be appreciated.

Thanks!

<table width="450" border="0">
<tr>
<td width="218"> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">First
Name</font></strong></font></div></td>
<td width="222" valign="baseline"> <form name="member" method="post" action="">
<input type="text" name="textfield">
</form></td>
</tr>
<tr>
<td> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">Last
Name</font></strong></font></div></td>
<td valign="baseline"> <form name="member" method="post" action="">
<input type="text" name="textfield2">
</form></td>
</tr>
<tr>
<td height="31"> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">Mailing
Address</font></strong></font></div></td>
<td valign="baseline"> <form name="member" method="post" action="">
<input type="text" name="textfield3">
</form></td>
</tr>
<tr>
<td> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">Physical
Address</font></strong></font></div></td>
<td valign="baseline"> <form name="member" method="post" action="">
<input type="text" name="textfield4">
</form></td>
</tr>
<tr>
<td> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">City/Town</font></strong></font></div></td>
<td valign="baseline"> <form name="member" method="post" action="">
<input type="text" name="textfield5">
</form></td>
</tr>
<tr>
<td height="17"> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">Province</font></strong></font></div></td>
<td valign="baseline"><strong><font size="2" face="Arial, Helvetica, sans-serif">Ontario</font></strong></td>
</tr>
<tr>
<td> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">Postal
Code</font></strong></font></div></td>
<td valign="baseline"> <form name="member" method="post" action="">
<input type="text" name="textfield6">
</form></td>
</tr>
<tr>
<td> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">Day
Phone</font></strong></font></div></td>
<td valign="baseline"> <form name="member" method="post" action="">
<input type="text" name="textfield7">
</form></td>
</tr>
<tr>
<td> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">Night
Phone</font></strong></font></div></td>
<td valign="baseline"> <form name="member" method="post" action="">
<input type="text" name="textfield8">
</form></td>
</tr>
<tr>
<td> <p align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">Email</font></strong></font></p></td>
<td valign="baseline"> <form name="member" method="post" action="">
<input type="text" name="textfield9">
</form></td>
</tr>
<tr>
<td> <p align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">How
did you hear about us?</font></strong></font></p></td>
<td valign="baseline"> <form name="member" method="post" action="">
<select name="select" size="1">
<option selected>Please Select One</option>
<option>Radio</option>
<option>Television</option>
<option>Newspaper</option>
<option>Word of Mouth</option>
<option>Internet</option>
<option>Sales Representative</option>
</select>
</form></td>
</tr>
<tr>
<td> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif"><strong><font color="#336600">Whatis
your primary Energy type?</font></strong></font></div></td>
<td valign="baseline"> <form name="member" method="post" action="">
<select name="select2" sze="1">
<option selected>Please Select One</option>
<option>Natural Gas</option>
<option>Electricity</option>
<option>Solar</option>
<option>Wind</option>
</select>
</form></td>

ray326
10-21-2004, 03:21 PM
First, that whole thing should be a single form, not a form for every field (but that's HTML) and the action for the form should point to a servlet written to process that form (that's Java). Other than that there's not much I can say because there's no Java question in your post.

Khalid Ali
10-21-2004, 03:58 PM
its seems to me an HTML question..so I am moving it.

Ben Rogers
10-21-2004, 08:26 PM
Well, first of all, let's clean up that code, mm?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<title>Contact Us</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
form div {width: 25em;}
form div div {
width: 100%;
float: left;
clear: both;
margin-bottom: 3px;
}
form div div label {
display: block;
float: left;
text-align: right;
width: 16em;
font-weight: 500;
font-family: Arial, Helvetica, sans-serif;
font-size: 0.9em;
font-weight: 500;
color: #336600;
}
form div div input,
form div div em,
form div div select {
display: block;
width: 12em;
float: right;
text-align: left;
}
form div div em {width: 10em;}
</style>
</head>
<body>
<form action="" method="post">
<div>
<div><label for="fname">First name:</label><input type="text" name="fname" id="fname" /></div>
<div><label for="lname">Last name:</label><input type="text" name="lname" id="lname" /></div>
<div><label for="mail">Mailing Address</label><input type="text" name="mail" id="mail" /></div>
<div><label for="phys">Physical Address:</label><input type="text" name="phys" id="phys" /></div>
<div><label for="city">City/Town:</label><input type="text" name="city" id="city" /></div>
<div><label>Province:</label><em>Ontario</em></div>
<div><label for="pcode">Postal Code:</label><input type="text" name="pcode" id="pcode" /></div>
<div><label for="dphone">Day Phone:</label><input type="text" name="dphone" id="dphone" /></div>
<div><label for="nphone">Night Phone:</label><input type="text" name="nphone" id="nphone" /></div>
<div><label for="email">E-mail:</label><input type="text" name="email" id="email" /></div>
<div>
<label for="refer">How did you hear about us?</label>
<select name="refer" id="refer">
<option selected="selected">Please Select One</option>
<option value="radio">Radio</option>
<option value="tv">Television</option>
<option value="news">Newspaper</option>
<option value="friend">Word of Mouth</option>
<option value="web">Internet</option>
<option value="salesrep">Sales Rep</option>
</select>
</div>
<div>
<label for="type">What is your primary energy type?</label>
<select name="energy" id="type">
<option selected="selected">Please Select One</option>
<option value="ngas">Natural Gas</option>
<option value="electric">Electricity</option>
<option value="solar">Solar</option>
<option value="wind">Wind</option>
</select>
</div>
</div>
</form>
</body>
</html> (Example (http://projep.no-ip.com:81/test/forum/forms.html)). Now, as for sending this to you, WebDevFaqs tells you how to do this in PHP. <http://webdevfaqs.com/php.php#mailer>