webber09 Posted September 10, 2009 Share Posted September 10, 2009 this is a very quick example of the kind of content I will have. <form> Required bit rate <select> <option>128kbps</option> <option>192kbps</option> <option>240kbps</option> <option>320kbps</option> </select><br /> Required listener ammount <select> <option>up to 100</option> <option>up to 200</option> <option>up to 400</option> <option>400+</option> </select><br /> Auto DJ? <select> <option>Yes</option> <option>No</option> </select> </form> what i need is for the form to detect the value selected in the <option> and, depending on which are selected, add a set amount of money for each <option> and give a final total at the end =] Quote Link to comment https://forums.phpfreaks.com/topic/173784-php-form/ Share on other sites More sharing options...
ignace Posted September 10, 2009 Share Posted September 10, 2009 <form> Required bit rate <select name="bitrate"> <option value="">128kbps</option> <option value="">192kbps</option> <option value="">240kbps</option> <option value="">320kbps</option> </select><br /> Required listener ammount <select name="listeners"> <option value="">up to 100</option> <option value="">up to 200</option> <option value="">up to 400</option> <option value="">400+</option> </select><br /> Auto DJ? <select name="dj"> <option value="">Yes</option> <option value="">No</option> </select> <button type="submit" name="calculate">Calculate</button> </form> Add the price between " in the value="" for each. if (isset($_POST['calculate'])) { $bitrate = floatval($_POST['bitrate']); $listeners = floatval($_POST['listeners']); $dj = floatval($_POST['dj']); print $bitrate + $listeners + $dj; } Note: This is an example and should not be used in production. Quote Link to comment https://forums.phpfreaks.com/topic/173784-php-form/#findComment-916139 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.