Hello i'm working on some project and i have 6 dropdowns and every has it values
Example in first dropdown i have:
<input type="checkbox" id="dt1" name="dt1" value="1">20 kW<br>
<input type="checkbox" id="dt2" name="dt2" value="2">40 kW <br>
<input type="checkbox" id="dt3" name="dt3" value="3">60 kW <br>
And in Other i have:
<input type="checkbox" id="stv1" name="stv1" value="6">500 L<br>
<input type="checkbox" id="stv2" name="stv2" value="7">1000 L<br>
<input type="checkbox" id="stv3" name="stv3" value="8">"2000 L<br>
But now i have many questions first how can i make drop down with only one selection? second question is how can i give result when someone choose from drop down one value 1 and from drop down 2 value 8 how can i make value1+value8=link?
Till now i have used
if (containsOnly(values, ['1', '8'])) {
alert('something');
}
but now i dont need alert, i need link so if someone can help me or do something on JS Fiddle that would be great
my latest work on this topic was this http://jsfiddle.net/KyleMuir/bUdra/5/ but now its not just choice a b or c, it must be choice a drop down with 3 or 4 choices and without alert.. If someone could help me it would be great
with this code you can get both values in the same file or in an other file just edit it to what you need:
<?php
if($_POST) {
$dd1 = $_POST['dropdown1'];
$dd2 = $_POST['dropdown2'];
header('Location: file.php?dd1='.$dd1.'&dd2='.$dd2);
exit();
}
?>
<form action="" method="post">
<select name="dropdown1">
<option value="20">20 kW</option>
<option value="40">40 kW</option>
<option value="60">60 kW</option>
</select>
<select name="dropdown2">
<option value="500">500 L</option>
<option value="1000">1000 L</option>
<option value="2000">2000 L</option>
</select>
<input type="submit" value="Calculate">
</form>
file.php could then be something like:
<?php
$dd1 = strip_tags($_GET['dd1']);
$dd2 = strip_tags($_GET['dd2']);
echo $dd1; //should give you the value from dropdown1
echo $dd2; //should give yout the value from dropdown2
?>
<!-- the php variables can also be used in javascript -->
<!-- don't know for sure if this is the correct way to use php in javascript but atleast should be something like this -->
<script type="text/javascript">
var dropdown1 = <?php $dd1; ?>;
var dropdown2 = <?php $dd2; ?>;
</script>