Hi, i am having a problem here with PHP (Brand new in this area  ). See my form below:
http://docs.google.com/leaf?id=0B4oe...OTg3OThk&hl=en
What i am trying to do is,
a) For Play_1, user will choose First or Second. If the user choose First then on the right side into the textarea (first row, last column) automatically value 10 will appear. Or if the user choose second then on the right side into the textarea (first row, last column) automatically value 5 will appear.
b) For Play_2, it will work just like Play_1
c) Finally, the code will get the main two values of Play_1 and Play_2 (last column, two rows), sum them up and present the Total in the Total textarea.
The code i have written is as follows, which is for sure not running:
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
<body> <form name="form1" method="post" action=""> <table width="266" border="1"> <tr> <td width="49">Play_1</td> <td width="61">First <input name="radiobutton" type="radio" value='10'></td> <td width="92">Second <input name="radiobutton" type="radio" value='5'></td> <?php $selected_radio = $_POST['radiobutton']; if($selected_radio == 10) { $v1=10; } else if ($selected_radio == 5) { $v1=5; } ?> <td width="36"><input name="textarea" type="text" value= "<?php echo $v1; ?>" size="5"></td> </tr> <tr> <td>Play_2</td> <td>First <input name="radiobutton1" type="radio" value="10"></td> <td>Second <input name="radiobutton1" type="radio" value="5"></td> <?php $selected_radio = $_POST['radiobutton1']; if($selected_radio == 10) { $v2=10; } else if ($selected_radio == 5) { $v2=5; } ?> <td><input name="textarea2" type="text" value="<?php echo $v2; ?>" size="5"></td> </tr> <tr> <td> </td> <td> </td> <td>Total : </td> <td><input name="textarea3" type="text" value="<?php echo $v1+$v2; ?>" size="5"></td> </tr> </table> </form> </body> </html>
Can anyone please guide me? Thanks in advance 
|