Reposting original question
Posted: Tue May 29, 2007 10:59 am
Everah | Please use
and here is the php processing script (i know this part is wrong, and possibly the HTML , the way im calling it .[/syntax]
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Original Question
****************
hi, i cant figure out what the correct syntax or commands are for this. I made an HTML page , i would like the variables selected form drop down menus to then be sent to a PHP processing script, to do math and then send the resulting new variable back to the same HTML page and appear within an <input> text box .
i made this stripped down version to show you.
Here is the HTML page code:
[syntax="html"]<HTML>
<HEAD></HEAD>
<body>
<center>
<FORM name="formx" method="POST" action="dropdown_handler.php">
<select name="a" STYLE="width: 110 px">
<option value="">Please Select</option>
<option value="0">1</option>
<option value=".10">2</option>
</select>
<br><br>
<select name="b" STYLE="width: 110 px">
<option value="">Please Select</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<br><br>
<select name="c" STYLE="width: 110 px">
<option value="">Please Select</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<br><br>
<select name="d" STYLE="width: 110 px">
<option value="">Please Select</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<br><br>
<select name="f" STYLE="width: 110 px">
<option value="">Please Select</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<br><br>
<select name="g" STYLE="width: 110 px" onChange="submit(this.formx)">
<option selected="selected" value="">Please Select</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<br><br>
<input name="ans" type="text" size="5" readonly="readonly" value="0">
</form>
</body>
</html>
and here is the php processing script (i know this part is wrong, and possibly the HTML , the way im calling it .[/syntax]
Code: Select all
<?php
$a = $_REQUEST('a[]');
$b = $_REQUEST('b[]');
$c = $_REQUEST('c[]');
$d = $_REQUEST('d[]');
$f = $_REQUEST('f[]');
$g = $_REQUEST('g[]');
function a_times_b () {
$e = ($a*$b) + ($a*$c) + ($a*$d) + ($a*$f) + $g;
$e = number_format ($total, 2);
return array ($e);
}
?>Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]