Array of select options

<?php

if(isset($_POST['submit'])){
$selected_ratio = $_POST['selected_ratio'];
$ratio_array = explode(',', $selected_ratio);

$the_width = $ratio_array[0];
$the_height = $ratio_array[1];
$the_name = $ratio_array[2];
$aspect_ratio = $ratio_array[3];
}

?>

<form action="" method="post">
<select class="select_field" name="selected_ratio">
<option value="1280,720,HD 720,16:9" <?php if($selected_ratio == '1280,720,HD 720,16:9') echo 'selected="selected"';?>>HD 720</option>
<option value="1920,1080,HD 1080,16:9" <?php if($selected_ratio == '1920,1080,HD 1080,16:9') echo 'selected="selected"';?>>HD 1080</option>
</select>
<input class="calculate_btn" name="" type="submit" value="Calculate Ratio" />
</form>

0 Comments

You must be logged in to post a comment.