SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | ||
4 | $menucompare=""; | |
5 | if (isset($_POST["menucompare"])) | |
6 | { | |
7 | ||
8 | $menucompare= $_POST['menucompare']; | |
9 | $table1 = ' | |
10 | <table id= "Table1" width="100%" border="1" cellspacing="0" cellpadding="0"> | |
11 | <!--SW - You need a tr tag around these headers--> | |
12 | <th >Weeks</th> | |
13 | <th ><p></p></th> | |
14 | <th > More Details</th> | |
15 | ||
16 | ||
17 | <tr id="tr"> | |
18 | ||
19 | <tr id= "tr " > | |
20 | <td >gggg</td> | |
21 | <td >kkkkk</td> | |
22 | <td > | |
23 | <form name ="dets" method="POST" action=""> | |
24 | <input class = "showt" name ="wnumber" id ="wnumber" type="submit" value= "More Details" /> | |
25 | <input type="hidden" name="data" value="wnumber" /> | |
26 | <input type="hidden" name="menucompare" value="'. $menucompare.'" /> | |
27 | ||
28 | <noscript> | |
29 | <input type="submit" value="Submit"/> | |
30 | </noscript> | |
31 | </form> | |
32 | </td> | |
33 | </tr> | |
34 | </tr> | |
35 | </table> '; | |
36 | } | |
37 | if (isset($_POST["data"])) | |
38 | { | |
39 | // put whatever db process you need somwhere in this if statement | |
40 | ||
41 | $table1 = ' | |
42 | <table id= "Table1" width="100%" border="1" cellspacing="0" cellpadding="0"> | |
43 | <!--SW - You need a tr tag around these headers--> | |
44 | <th >Weeks</th> | |
45 | <th ><p></p></th> | |
46 | <th > More Details</th> | |
47 | ||
48 | ||
49 | <tr id="tr"> | |
50 | ||
51 | <tr id= "tr " > | |
52 | <td >gggg</td> | |
53 | <td >kkkkk</td> | |
54 | <td > | |
55 | <form name ="dets" method="POST" action=""> | |
56 | <input class = "showt" name ="wnumber" id ="wnumber" type="submit" value= "More Details" /> | |
57 | <input type="hidden" name="row_id" value="value of row id" /> | |
58 | <input type="hidden" name="data" value="wnumber" /> | |
59 | <input type="hidden" name="menucompare" value="'. $menucompare.'" /> | |
60 | ||
61 | ||
62 | <noscript> | |
63 | <input type="submit" value="Submit"/> | |
64 | </noscript> | |
65 | </form> | |
66 | </td> | |
67 | </tr> | |
68 | </tr> | |
69 | </table> '; | |
70 | ||
71 | ||
72 | $table2 = ' | |
73 | <div id="Table2"> | |
74 | <table width="100%" border="1" cellspacing="0" cellpadding="0"> | |
75 | <tr> | |
76 | <th id="wekkNum"> wnumber</th> | |
77 | <th>Your place</th> | |
78 | <th>Your arr</th> | |
79 | </tr> | |
80 | ||
81 | <tr > | |
82 | <td>hhhh</td> | |
83 | <td>kkkk</td> | |
84 | <td>jjjj</td> | |
85 | </tr> | |
86 | ||
87 | </table> | |
88 | </div> | |
89 | '; | |
90 | } | |
91 | ?> | |
92 | ||
93 | <script src="http://code.jquery.com/jquery-latest.js"></script> | |
94 | <script type="text/javascript"> | |
95 | /*Start Functions*/ | |
96 | function displayVals() { | |
97 | var singleValues = $("select option:selected").text(); | |
98 | $("#hiddenselect").val(singleValues); | |
99 | $("p").html("Procent of :    " + singleValues); | |
100 | } | |
101 | /*End functions*/ | |
102 | ||
103 | /*Start Ready*/ | |
104 | $(document).ready(function(){ | |
105 | $("select").change(function() { | |
106 | displayVals(); | |
107 | }); | |
108 | displayVals(); | |
109 | ||
110 | $("select#menucompare").change(function() { | |
111 | $("#aform").submit(); | |
112 | }); | |
113 | }); | |
114 | /*End Ready*/ | |
115 | </script> | |
116 | <form id="aform" method="post"> | |
117 | <select id="menucompare" name ="menucompare" size="1" onchange="submitaform()"> | |
118 | <option selected='selected'>Select one</option> | |
119 | <option value="value1" <?php if ($menucompare == "value1") { echo " selected='selected'"; } ?> >Text 1</option> | |
120 | <option value="value2" <?php if ($menucompare == "value2") { echo " selected='selected'"; } ?> >Text 2</option> | |
121 | <option value="value3" <?php if ($menucompare == "value3") { echo " selected='selected'"; } ?> >Text 3</option> | |
122 | <option value="value4" <?php if ($menucompare == "value4") { echo " selected='selected'"; } ?> >Text 4</option> | |
123 | ||
124 | </select> | |
125 | <input type="hidden" name="hiddenselect" value="<?php echo $menucompare ; ?>" /> | |
126 | </form> | |
127 | <?php | |
128 | if (isset($table1)) | |
129 | { | |
130 | print $table1; | |
131 | } | |
132 | if (isset($table2)) | |
133 | { | |
134 | print $table2; | |
135 | } | |
136 | ?> |