When You will write anything on textarea. It will auto height expand.
Example:
CSS
<style>
textarea {
resize: none;
overflow: hidden;
min-height: 50px;
max-height: 100px;
}
</style>
Example:
JAVASCRIPT
<script>
function auto_grow(element) {
element.style.height = "5px";
element.style.height = (element.scrollHeight) + "px";
}
</script>
Example:
HTML
<script>
function auto_grow(element) {
element.style.height = "5px";
element.style.height = (element.scrollHeight) + "px";
}
</script>
<style>
textarea {
resize: none;
overflow: hidden;
min-height: 50px;
max-height: 100px;
}
</style>
<textarea oninput="auto_grow(this)">
</textarea>
I achieved it by using the PHP explode
function, like this:
Example:
HTML
<form name="car_form" method="post" action="doublevalue_action.php">
<select name="car" id="car">
<option value="">Select Car</option>
<option value="BMW|Red">Red BMW</option>
<option value="Mercedes|Black">Black Mercedes</option>
</select>
<input type="submit" name="submit" id="submit" value="submit">
</form>
Example:
PHP
<?php
$result = $_POST['car'];
$result_explode = explode('|', $result);
echo "Model: ". $result_explode[0]."<br />";
echo "Colour: ". $result_explode[1]."<br />";
?>