Java Reference
In-Depth Information
The implementation is contained in a single PHP file, called
Product.php
. Portions of this file are discussed next.
14.1.1
Filling the Input Values Using Javascript
The first section of the source code of
Product.php
produces a form
that presents the three attributes to be filled by the user. The first two
attributes,
education
and
marital-status
, are discrete and a drop-down
list supplies the possible values; the third attribute is a continuous
attribute called
capital-gains
. The code below produces this form such
that when the user clicks on the
Score
button, these values are for-
warded and the PHP code is run.
1. <html>
2. <head>
3. <title>Product Recommendation through JDM Web Services</title>
4. </head>
5. <script language
"JavaScript" type
"text/javascript">
6. <body>
7. <form method
"POST" action
"Product.php">
8. <table cellpadding
"5" cellspacing
"0" border
"1" width
"50%">
9. <tr>
10. <td width
"40%"><b>Variable</b></td>
11. <td><b>Value</b></td>
12. </tr>
13. <tr>
14. <td>education</td>
15. <td align
"Left"><select name
"education" >
16. <option value
"5th-6th"> 5th-6th
17. <option value
"7th-8th"> 7th-8th
18. <option value
"9th"> 9th
19. <option value
"10th"> 10th
20. <option value
"11th"> 11th
21. <option value
"12th"> 12th
22. <option value
"Assoc-acdm"> Assoc-acdm
23. <option value
"Assoc-voc"> Assoc-voc
24. <option value
"Bachelors""> Bachelors
25. <option value
"Doctorate"> Doctorate
26. <option value
"HS-grad"> HS-grad
27. <option value
"Masters"> Masters
28. <option value
"Prof-school"> Prof-school
29. <option value
"Some-college"> Some-college
30. </select><br/></td>
31. </tr>
32.
33. <tr>
34. <td>marital-status</td>
35. <td align
"Left"><select name
"marital-status" >
36. <option value
"Divorced"> Divorced
Search WWH ::
Custom Search